defines.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 processing;
  45. bool longPress;
  46. PlayState state;
  47. unsigned int last_tick;
  48. uint8_t selectRow;
  49. uint8_t selectColumn;
  50. int8_t selected_card;
  51. CardAnimation animation;
  52. uint8_t *buffer;
  53. FuriMutex* mutex;
  54. } GameState;