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