flip_world.h 4.2 KB

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