defines.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #include "common/menu.h"
  10. #define APP_NAME "Blackjack"
  11. #define CONF_ANIMATION_DURATION "AnimationDuration"
  12. #define CONF_MESSAGE_DURATION "MessageDuration"
  13. #define CONF_STARTING_MONEY "StartingMoney"
  14. #define CONF_ROUND_PRICE "RoundPrice"
  15. #define CONF_SOUND_EFFECTS "SoundEffects"
  16. typedef enum {
  17. EventTypeTick,
  18. EventTypeKey,
  19. } EventType;
  20. typedef struct{
  21. uint32_t animation_duration;
  22. uint32_t message_duration;
  23. uint32_t starting_money;
  24. uint32_t round_price;
  25. bool sound_effects;
  26. } Settings;
  27. typedef struct {
  28. EventType type;
  29. InputEvent input;
  30. } AppEvent;
  31. typedef enum {
  32. GameStateGameOver,
  33. GameStateStart,
  34. GameStatePlay,
  35. GameStateSettings,
  36. GameStateDealer,
  37. } PlayState;
  38. typedef enum {
  39. DirectionUp,
  40. DirectionDown,
  41. DirectionRight,
  42. DirectionLeft,
  43. Select,
  44. Back,
  45. None
  46. } Direction;
  47. typedef struct {
  48. Card player_cards[21];
  49. Card dealer_cards[21];
  50. uint8_t player_card_count;
  51. uint8_t dealer_card_count;
  52. Direction selectDirection;
  53. Settings settings;
  54. uint32_t player_score;
  55. uint32_t bet;
  56. uint8_t selectedMenu;
  57. bool doubled;
  58. bool started;
  59. bool processing;
  60. Deck deck;
  61. PlayState state;
  62. QueueState queue_state;
  63. Menu *menu;
  64. unsigned int last_tick;
  65. FuriMutex* mutex;
  66. } GameState;