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. #include <assets_icons.h>
  22. #define TAG "Mine Sweeper Application"
  23. // This is a helper struct for the settings view/scene
  24. typedef struct {
  25. uint8_t board_width, board_height, difficulty;
  26. bool ensure_solvable_board;
  27. FuriString* width_str;
  28. FuriString* height_str;
  29. VariableItem* difficulty_item;
  30. VariableItem* width_item;
  31. VariableItem* height_item;
  32. VariableItem* solvable_item;
  33. } MineSweeperAppSettings;
  34. // Main MineSweeperApp
  35. typedef struct MineSweeperApp {
  36. SceneManager* scene_manager;
  37. ViewDispatcher* view_dispatcher;
  38. NotificationApp* notification;
  39. StartScreen* start_screen;
  40. Loading* loading;
  41. MineSweeperGameScreen* game_screen;
  42. DialogEx* menu_screen;
  43. VariableItemList* settings_screen;
  44. DialogEx* confirmation_screen;
  45. TextBox* info_screen;
  46. MineSweeperAppSettings settings_info;
  47. MineSweeperAppSettings t_settings_info;
  48. uint8_t is_settings_changed;
  49. bool ensure_map_solvable;
  50. uint8_t feedback_enabled;
  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