-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameCtrlIC.cpp
More file actions
31 lines (25 loc) · 870 Bytes
/
GameCtrlIC.cpp
File metadata and controls
31 lines (25 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "GameCtrlIC.h"
#include "GameManager.h"
#include "Messages_defs.h"
GameCtrlIC::GameCtrlIC(SDL_Keycode ctrlKey) :
ctrlKey_(ctrlKey) {
}
GameCtrlIC::~GameCtrlIC()
{
}
void GameCtrlIC::handleInput(Container* c, Uint32 time) {
if (InputHandler::getInstance()->isAnyKeyDown()) {
if (InputHandler::getInstance()->isKeyDown(ctrlKey_))
{
if (!static_cast<GameManager*>(c)->getRunning()) {
if (static_cast<GameManager*>(c)->getGameOver()) {
//msg::Message tipo GAME_START
//send(this, msg::Message(msg::NO_MORE_ASTEROIDS, getId(), msg::Broadcast));
static_cast<GameManager*>(c)->getGame()->send(this, msg::Message(msg::GAME_START, c->getId(), msg::Broadcast));
}
//msg::Message tipo ROUND_START
static_cast<GameManager*>(c)->getGame()->send(this, msg::Message(msg::ROUND_START, c->getId(), msg::Broadcast));
}
}
}
}