flip_world.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #pragma once
  2. #include <easy_flipper/easy_flipper.h>
  3. #include <flipper_http/flipper_http.h>
  4. #include <font/font.h>
  5. // added by Derek Jamison to lower memory usage
  6. #undef FURI_LOG_E
  7. #define FURI_LOG_E(tag, msg, ...)
  8. #undef FURI_LOG_I
  9. #define FURI_LOG_I(tag, msg, ...)
  10. #undef FURI_LOG_D
  11. #define FURI_LOG_D(tag, msg, ...)
  12. //
  13. #define TAG "FlipWorld"
  14. #define VERSION 0.5
  15. #define VERSION_TAG TAG " " FAP_VERSION
  16. // Define the submenu items for our FlipWorld application
  17. typedef enum
  18. {
  19. FlipWorldSubmenuIndexRun, // Click to run the FlipWorld application
  20. FlipWorldSubmenuIndexMessage,
  21. FlipWorldSubmenuIndexSettings,
  22. FlipWorldSubmenuIndexWiFiSettings,
  23. FlipWorldSubmenuIndexGameSettings,
  24. FlipWorldSubmenuIndexUserSettings,
  25. } FlipWorldSubmenuIndex;
  26. // Define a single view for our FlipWorld application
  27. typedef enum
  28. {
  29. FlipWorldViewSubmenu, // The submenu
  30. FlipWorldViewMessage, // The about, loading screen
  31. FlipWorldViewSettings, // The settings screen
  32. FlipWorldViewVariableItemList, // The variable item list screen
  33. FlipWorldViewTextInput, // The text input screen
  34. //
  35. FlipWorldViewWidgetResult, // The text box that displays the random fact
  36. FlipWorldViewLoader, // The loader screen retrieves data from the internet
  37. } FlipWorldView;
  38. // Define a custom event for our FlipWorld application
  39. typedef enum
  40. {
  41. FlipWorldCustomEventProcess,
  42. FlipWorldCustomEventPlay, // Play the game
  43. } FlipWorldCustomEvent;
  44. // Each screen will have its own view
  45. typedef struct
  46. {
  47. View *view_loader;
  48. Widget *widget_result;
  49. //
  50. ViewDispatcher *view_dispatcher; // Switches between our views
  51. View *view_message; // The about, loading screen
  52. Submenu *submenu; // The submenu
  53. Submenu *submenu_settings; // The settings submenu
  54. VariableItemList *variable_item_list; // The variable item list (settngs)
  55. VariableItem *variable_item_wifi_ssid; // The variable item for WiFi SSID
  56. VariableItem *variable_item_wifi_pass; // The variable item for WiFi password
  57. //
  58. VariableItem *variable_item_game_fps; // The variable item for Game FPS
  59. VariableItem *variable_item_game_screen_always_on; // The variable item for Screen always on
  60. VariableItem *variable_item_game_download_world; // The variable item for Download world
  61. VariableItem *variable_item_game_sound_on; // The variable item for Sound on
  62. VariableItem *variable_item_game_vibration_on; // The variable item for Vibration on
  63. VariableItem *variable_item_game_player_sprite; // The variable item for Player sprite
  64. VariableItem *variable_item_game_vgm_x; // The variable item for VGM X
  65. VariableItem *variable_item_game_vgm_y; // The variable item for VGM Y
  66. //
  67. VariableItem *variable_item_user_username; // The variable item for the User username
  68. VariableItem *variable_item_user_password; // The variable item for the User password
  69. TextInput *text_input; // The text input
  70. char *text_input_buffer; // Buffer for the text input
  71. char *text_input_temp_buffer; // Temporary buffer for the text input
  72. uint32_t text_input_buffer_size; // Size of the text input buffer
  73. } FlipWorldApp;
  74. extern char *fps_choices_str[];
  75. extern int fps_index;
  76. extern char *yes_or_no_choices[];
  77. extern int screen_always_on_index;
  78. extern int sound_on_index;
  79. extern int vibration_on_index;
  80. extern char *player_sprite_choices[];
  81. extern int player_sprite_index;
  82. extern char *vgm_levels[];
  83. extern int vgm_x_index;
  84. extern int vgm_y_index;
  85. float atof_(const char *nptr);
  86. float atof_furi(const FuriString *nptr);
  87. bool is_str(const char *src, const char *dst);
  88. bool is_enough_heap(size_t heap_size);