parent
80c996a48c
commit
a80adc6f44
11 changed files with 65 additions and 26 deletions
@ -1,10 +1,21 @@ |
||||
#include <QPainter> |
||||
#include "Game.h" |
||||
#include "InputWindow.h" |
||||
|
||||
void Game::draw(QPixmap &output) { |
||||
QPainter p(&output); |
||||
double w = output.size().width(); |
||||
double h = output.size().height(); |
||||
p.fillRect(w / 2 - 10, h / 2 - 10, 20, 20, Qt::red); |
||||
p.drawEllipse(0, 0, 20, 20); |
||||
|
||||
player.draw(p); |
||||
} |
||||
|
||||
void Game::update(float dTime) { |
||||
player.update(dTime); |
||||
} |
||||
|
||||
Game::Game() { |
||||
InputWindow::inputQueue->registerListener(&player); |
||||
} |
||||
|
||||
GameQueue * Game::eventQueue = new GameQueue; |
||||
|
@ -1,10 +1,15 @@ |
||||
#pragma once |
||||
|
||||
#include "Queue.h" |
||||
#include "Player.h" |
||||
#include "Spectator.h" |
||||
|
||||
class Game { |
||||
GameQueue * eventQueue = new GameQueue; |
||||
|
||||
Player player; |
||||
std::vector<Spectator> spectators; |
||||
public: |
||||
static GameQueue * eventQueue; |
||||
explicit Game(); |
||||
void draw(QPixmap & output); |
||||
void update(float dTime); |
||||
}; |
||||
|
Loading…
Reference in new issue