defines.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 { GameStateGameOver, GameStateStart, GameStatePlay, GameStateAnimate } PlayState;
  19. typedef struct {
  20. uint8_t* buffer;
  21. Card card;
  22. int8_t deck;
  23. int indexes[4];
  24. float x;
  25. float y;
  26. float vx;
  27. float vy;
  28. bool started;
  29. } CardAnimation;
  30. typedef struct {
  31. Deck deck;
  32. Hand bottom_columns[7];
  33. Card top_cards[4];
  34. bool dragging_deck;
  35. uint8_t dragging_column;
  36. Hand dragging_hand;
  37. InputKey input;
  38. bool started;
  39. bool had_change;
  40. bool processing;
  41. bool longPress;
  42. PlayState state;
  43. unsigned int last_tick;
  44. uint8_t selectRow;
  45. uint8_t selectColumn;
  46. int8_t selected_card;
  47. CardAnimation animation;
  48. uint8_t* buffer;
  49. FuriMutex* mutex;
  50. } GameState;