rewrite chaingame

This commit is contained in:
2021-10-22 16:31:26 +02:00
parent 85528a619d
commit 48a1126a1c
2 changed files with 115 additions and 38 deletions

View File

@@ -5,6 +5,18 @@
#include "buttons.h"
#include "game.h"
#define PLAYNEXTTIMEOUT 3000 // 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:
@@ -14,11 +26,14 @@ private:
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} {}
c_chaingame(e_ledcolor gamecolor) : c_game{chaingame, gamecolor} {}
void runGame(void);
bool initGame(void);
void resetGame(void);
@@ -27,5 +42,4 @@ public:
// void HandleChainGame( bool newstate );
// void ResetChainGame(void);
#endif //CHAINGAMEH
#endif // CHAINGAMEH