minesweeper.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef MINESWEEPER_H
  2. #define MINESWEEPER_H
  3. #include <string.h> // memset
  4. #include <inttypes.h> // PRIu8 & SCNu8
  5. #include <furi.h>
  6. #include <furi_hal.h>
  7. #include <input/input.h>
  8. #include <notification/notification_messages.h>
  9. #include <gui/gui.h>
  10. #include <gui/view_dispatcher.h>
  11. #include <gui/scene_manager.h>
  12. #include <gui/modules/loading.h>
  13. #include <gui/modules/dialog_ex.h>
  14. #include <gui/modules/variable_item_list.h>
  15. #include <gui/modules/text_box.h>
  16. #include "scenes/minesweeper_scene.h"
  17. #include "views/start_screen.h"
  18. #include "views/minesweeper_game_screen.h"
  19. #include "helpers/mine_sweeper_storage.h"
  20. #include "minesweeper_redux_icons.h"
  21. #define TAG "Mine Sweeper Application"
  22. // This is a helper struct for the settings view/scene
  23. typedef struct {
  24. uint8_t board_width, board_height, difficulty;
  25. bool ensure_solvable_board;
  26. FuriString* width_str;
  27. FuriString* height_str;
  28. VariableItem* difficulty_item;
  29. VariableItem* width_item;
  30. VariableItem* height_item;
  31. VariableItem* solvable_item;
  32. } MineSweeperAppSettings;
  33. // Main MineSweeperApp
  34. typedef struct MineSweeperApp {
  35. SceneManager* scene_manager;
  36. ViewDispatcher* view_dispatcher;
  37. NotificationApp* notification;
  38. StartScreen* start_screen;
  39. Loading* loading;
  40. MineSweeperGameScreen* game_screen;
  41. DialogEx* menu_screen;
  42. VariableItemList* settings_screen;
  43. DialogEx* confirmation_screen;
  44. TextBox* info_screen;
  45. MineSweeperAppSettings settings_info;
  46. MineSweeperAppSettings t_settings_info;
  47. bool is_settings_changed;
  48. bool ensure_map_solvable;
  49. uint32_t haptic;
  50. uint32_t speaker;
  51. uint32_t led;
  52. } MineSweeperApp;
  53. // View Id Enumeration
  54. typedef enum {
  55. MineSweeperStartScreenView,
  56. MineSweeperLoadingView,
  57. MineSweeperGameScreenView,
  58. MineSweeperMenuView,
  59. MineSweeperSettingsView,
  60. MineSweeperConfirmationView,
  61. MineSweeperInfoView,
  62. MineSweeperViewCount,
  63. } MineSweeperView;
  64. // Enumerations for hardware states
  65. // Will be used in later implementation
  66. typedef enum {
  67. MineSweeperHapticOff,
  68. MineSweeperHapticOn,
  69. } MineSweeperHapticState;
  70. typedef enum {
  71. MineSweeperSpeakerOff,
  72. MineSweeperSpeakerOn,
  73. } MineSweeperSpeakerState;
  74. typedef enum {
  75. MineSweeperLedOff,
  76. MineSweeperLedOn,
  77. } MineSweeperLedState;
  78. #endif