minesweeper.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. StartScreen* start_screen;
  38. Loading* loading;
  39. MineSweeperGameScreen* game_screen;
  40. DialogEx* menu_screen;
  41. VariableItemList* settings_screen;
  42. DialogEx* confirmation_screen;
  43. TextBox* info_screen;
  44. MineSweeperAppSettings settings_info;
  45. MineSweeperAppSettings t_settings_info;
  46. bool is_settings_changed;
  47. bool ensure_map_solvable;
  48. uint32_t haptic;
  49. uint32_t speaker;
  50. uint32_t led;
  51. } MineSweeperApp;
  52. // View Id Enumeration
  53. typedef enum {
  54. MineSweeperStartScreenView,
  55. MineSweeperLoadingView,
  56. MineSweeperGameScreenView,
  57. MineSweeperMenuView,
  58. MineSweeperSettingsView,
  59. MineSweeperConfirmationView,
  60. MineSweeperInfoView,
  61. MineSweeperViewCount,
  62. } MineSweeperView;
  63. // Enumerations for hardware states
  64. // Will be used in later implementation
  65. typedef enum {
  66. MineSweeperHapticOff,
  67. MineSweeperHapticOn,
  68. } MineSweeperHapticState;
  69. typedef enum {
  70. MineSweeperSpeakerOff,
  71. MineSweeperSpeakerOn,
  72. } MineSweeperSpeakerState;
  73. typedef enum {
  74. MineSweeperLedOff,
  75. MineSweeperLedOn,
  76. } MineSweeperLedState;
  77. #endif