defines.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <furi.h>
  3. #include <input/input.h>
  4. #include <gui/elements.h>
  5. #include <flipper_format/flipper_format.h>
  6. #include <flipper_format/flipper_format_i.h>
  7. #include "common/card.h"
  8. #include "common/queue.h"
  9. #define APP_NAME "Solitaire"
  10. typedef enum {
  11. EventTypeTick,
  12. EventTypeKey,
  13. } EventType;
  14. typedef struct {
  15. EventType type;
  16. InputEvent input;
  17. } AppEvent;
  18. typedef enum {
  19. GameStateGameOver,
  20. GameStateStart,
  21. GameStatePlay,
  22. GameStateAnimate,
  23. } PlayState;
  24. typedef struct {
  25. uint8_t* buffer;
  26. Card card;
  27. int8_t deck;
  28. int indexes[4];
  29. float x;
  30. float y;
  31. float vx;
  32. float vy;
  33. bool started;
  34. } CardAnimation;
  35. typedef struct {
  36. Deck deck;
  37. Hand bottom_columns[7];
  38. Card top_cards[4];
  39. bool dragging_deck;
  40. uint8_t dragging_column;
  41. Hand dragging_hand;
  42. InputKey input;
  43. bool started;
  44. bool had_change;
  45. bool processing;
  46. bool longPress;
  47. PlayState state;
  48. unsigned int last_tick;
  49. uint8_t selectRow;
  50. uint8_t selectColumn;
  51. int8_t selected_card;
  52. CardAnimation animation;
  53. uint8_t* buffer;
  54. FuriMutex* mutex;
  55. } GameState;