flip_world.h 3.9 KB

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