Files
Leo-led-truck/src/game.h

59 lines
1020 B
C++

#ifndef GAMEH
#define GAMEH
#include "led.h"
#define GAMESELECTTIMEOUT 10000 // 10sec * 1000ms
enum e_game
{
none,
simpleled,
chaingame,
magicswitchboard,
detectled
};
enum e_gamestate
{
disabled,
init,
active,
init_error
};
enum e_state
{
state_init,
state_idle,
state_play
};
class c_game
{
protected:
const e_game _gameindex;
e_gamestate _status;
const e_ledcolor _gamecolor;
public:
c_game(e_game index, e_ledcolor gamecolor) : _gameindex(index), _gamecolor(gamecolor) { _status = disabled; }
virtual void runGame(void);
virtual bool initGame(void);
virtual void resetGame(void);
e_gamestate getStatus(void) { return _status; }
e_game getIndex(void) { return _gameindex; }
void setStatus(e_gamestate newstate);
e_ledcolor getGameColor(void) { return _gamecolor; }
};
c_game *getGame(e_game game, e_ledcolor gamecolor);
void runGame(e_game game);
void runGames(void);
void activateGame(e_game nextgame);
void initGames(void);
void handleGames();
#endif //GAMEH