flip_world.h 3.0 KB

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