flip_world.h 3.6 KB

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