flip_world.h 4.4 KB

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