45 lines
885 B
C++
45 lines
885 B
C++
#ifndef CHAINGAMEH
|
|
#define CHAINGAMEH
|
|
|
|
#include "Arduino.h"
|
|
#include "buttons.h"
|
|
#include "game.h"
|
|
|
|
#define PLAYNEXTTIMEOUT 1500 // 3sec * 1000ms
|
|
|
|
typedef enum
|
|
{
|
|
cg_idle,
|
|
cg_play,
|
|
cg_play_next,
|
|
cg_cheat,
|
|
cg_cheat_next,
|
|
cg_reset
|
|
} cg_states;
|
|
|
|
class c_chaingame : public c_game
|
|
{
|
|
private:
|
|
uint8_t patternIndex;
|
|
//bool patternFlag = false;
|
|
uint16_t cheatbutton = 0;
|
|
//bool cheatButtonFlag = false;
|
|
uint16_t ledpattern[4] = {1, 3, 1, 2};
|
|
int patternlength = sizeof(ledpattern) / sizeof(ledpattern[0]);
|
|
cg_states state = cg_reset;
|
|
uint32_t playNextTimer=0;
|
|
|
|
void nextPattern(void);
|
|
void updateCheatButton(void);
|
|
|
|
public:
|
|
c_chaingame(e_ledcolor gamecolor) : c_game{chaingame, gamecolor} {}
|
|
void runGame(void);
|
|
bool initGame(void);
|
|
void resetGame(void);
|
|
};
|
|
|
|
// void HandleChainGame( bool newstate );
|
|
// void ResetChainGame(void);
|
|
|
|
#endif // CHAINGAMEH
|