flip_world.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #pragma once
  2. #include <font/font.h>
  3. #include <flipper_http/flipper_http.h>
  4. #include <easy_flipper/easy_flipper.h>
  5. #include <furi.h>
  6. #include <furi_hal.h>
  7. #include <gui/gui.h>
  8. #include <gui/view.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/view_dispatcher.h>
  11. #include <dialogs/dialogs.h>
  12. #define TAG "FlipWorld"
  13. #define VERSION 0.2
  14. #define VERSION_TAG "FlipWorld v0.2"
  15. // Define the submenu items for our FlipWorld application
  16. typedef enum
  17. {
  18. FlipWorldSubmenuIndexRun, // Click to run the FlipWorld application
  19. FlipWorldSubmenuIndexAbout,
  20. FlipWorldSubmenuIndexSettings,
  21. FlipWorldSubmenuIndexWiFiSettings,
  22. FlipWorldSubmenuIndexGameSettings,
  23. FlipWorldSubmenuIndexUserSettings,
  24. } FlipWorldSubmenuIndex;
  25. // Define a single view for our FlipWorld application
  26. typedef enum
  27. {
  28. FlipWorldViewSubmenu, // The submenu
  29. FlipWorldViewAbout, // The about screen
  30. FlipWorldViewSettings, // The settings screen
  31. FlipWorldViewVariableItemList, // The variable item list screen
  32. FlipWorldViewTextInput, // The text input screen
  33. //
  34. FlipWorldViewWidgetResult, // The text box that displays the random fact
  35. FlipWorldViewLoader, // The loader screen retrieves data from the internet
  36. } FlipWorldView;
  37. // Define a custom event for our FlipWorld application
  38. typedef enum
  39. {
  40. FlipWorldCustomEventProcess,
  41. FlipWorldCustomEventPlay, // Play the game
  42. } FlipWorldCustomEvent;
  43. // Each screen will have its own view
  44. typedef struct
  45. {
  46. View *view_loader;
  47. Widget *widget_result;
  48. //
  49. ViewDispatcher *view_dispatcher; // Switches between our views
  50. View *view_about; // The about screen
  51. Submenu *submenu; // The submenu
  52. Submenu *submenu_settings; // The settings submenu
  53. VariableItemList *variable_item_list; // The variable item list (settngs)
  54. VariableItem *variable_item_wifi_ssid; // The variable item for WiFi SSID
  55. VariableItem *variable_item_wifi_pass; // The variable item for WiFi password
  56. //
  57. VariableItem *variable_item_game_fps; // The variable item for Game FPS
  58. VariableItem *variable_item_game_screen_always_on; // The variable item for Screen always on
  59. VariableItem *variable_item_game_download_world; // The variable item for Download world
  60. VariableItem *variable_item_game_sound_on; // The variable item for Sound on
  61. VariableItem *variable_item_game_vibration_on; // The variable item for Vibration on
  62. //
  63. VariableItem *variable_item_user_username; // The variable item for the User username
  64. VariableItem *variable_item_user_password; // The variable item for the User password
  65. UART_TextInput *text_input; // The text input
  66. char *text_input_buffer; // Buffer for the text input
  67. char *text_input_temp_buffer; // Temporary buffer for the text input
  68. uint32_t text_input_buffer_size; // Size of the text input buffer
  69. } FlipWorldApp;
  70. extern char *game_fps_choices[];
  71. extern const float game_fps_choices_2[];
  72. extern int game_fps_index;
  73. extern char *yes_or_no_choices[];
  74. extern int game_screen_always_on_index;
  75. extern FlipWorldApp *app_instance;
  76. extern int game_sound_on_index;
  77. extern int game_vibration_on_index;
  78. bool is_enough_heap(size_t heap_size);