Game.h 852 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include <gui/canvas.h>
  3. #include <notification/notification.h>
  4. #include "utils/List.h"
  5. #include "utils/Card.h"
  6. #include "utils/RenderBuffer.h"
  7. #include "Deck.h"
  8. #include "TableauColumn.h"
  9. typedef enum {
  10. GameStateGameOver, GameStateStart, GameStatePlay, GameStateAnimate
  11. } PlayState;
  12. class Game {
  13. Deck *deck;
  14. Card *piles[4];
  15. TableauColumn tableau[7];
  16. List<Card> hand;
  17. PlayState state = GameStateStart;
  18. uint8_t current_row;
  19. uint8_t current_column;
  20. int8_t column_selection;
  21. RenderBuffer *buffer;
  22. uint32_t round_start;
  23. bool can_auto_solve;
  24. bool had_change = true;
  25. public:
  26. Game();
  27. void Render(Canvas* const canvas);
  28. void Reset();
  29. void NewRound();
  30. void LongPress(InputKey key);
  31. void Press(InputKey key);
  32. void Update(NotificationApp *app);
  33. ~Game();
  34. };