mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-22 01:34:13 -05:00
106 lines
3.2 KiB
C++
106 lines
3.2 KiB
C++
#pragma once
|
|
#include "StateManager.hpp"
|
|
#include "appstates/BaseState.hpp"
|
|
#include "data/data.hpp"
|
|
#include "sdl.hpp"
|
|
#include "ui/ControlGuide.hpp"
|
|
#include "ui/IconMenu.hpp"
|
|
|
|
#include <memory>
|
|
|
|
/// @brief The main
|
|
class MainMenuState final : public BaseState
|
|
{
|
|
public:
|
|
/// @brief Creates and initializes the main menu.
|
|
MainMenuState();
|
|
|
|
/// @brief Returns a new MainMenuState
|
|
static inline std::shared_ptr<MainMenuState> create() { return std::make_shared<MainMenuState>(); }
|
|
|
|
/// @brief Creates and returns a new MainMenuState. Pushes it automatically.
|
|
static inline std::shared_ptr<MainMenuState> create_and_push()
|
|
{
|
|
auto newState = MainMenuState::create();
|
|
StateManager::push_state(newState);
|
|
return newState;
|
|
}
|
|
|
|
/// @brief Runs update routine.
|
|
void update() override;
|
|
|
|
/// @brief Runs the sub-update routine.
|
|
void sub_update() override;
|
|
|
|
/// @brief Renders menu to screen.
|
|
void render() override;
|
|
|
|
/// @brief Signals to
|
|
static void initialize_view_states();
|
|
|
|
/// @brief Calls refresh on on view states in the vector.
|
|
static void refresh_view_states();
|
|
|
|
// clang-format off
|
|
struct DataStruct : sys::Task::DataStruct
|
|
{
|
|
data::UserList userList;
|
|
};
|
|
// clang-format on
|
|
|
|
private:
|
|
/// @brief Render target this state renders to.
|
|
sdl::SharedTexture m_renderTarget{};
|
|
|
|
/// @brief The background gradient.
|
|
sdl::SharedTexture m_background{};
|
|
|
|
/// @brief Icon for the settings option,
|
|
sdl::SharedTexture m_settingsIcon{};
|
|
|
|
/// @brief Icon for the extras option.
|
|
sdl::SharedTexture m_extrasIcon{};
|
|
|
|
/// @brief Special menu type that uses icons.
|
|
std::shared_ptr<ui::IconMenu> m_mainMenu{};
|
|
|
|
/// @brief Control guide in the bottom right.
|
|
std::shared_ptr<ui::ControlGuide> m_controlGuide{};
|
|
|
|
/// @brief This is the data struct passed to tasks.
|
|
std::shared_ptr<MainMenuState::DataStruct> m_dataStruct{};
|
|
|
|
/// @brief Records the size of the sm_users vector.
|
|
static inline int sm_userCount{};
|
|
|
|
/// @brief This is the list of user pointers from data.
|
|
static inline data::UserList sm_users{};
|
|
|
|
/// @brief This is the pointer to the settings state.
|
|
static inline std::shared_ptr<BaseState> sm_settingsState{};
|
|
|
|
/// @brief This is the pointer to the extras state.
|
|
static inline std::shared_ptr<BaseState> sm_extrasState{};
|
|
|
|
/// @brief This is the vector of title selection states.
|
|
static inline std::vector<std::shared_ptr<BaseState>> sm_states{};
|
|
|
|
/// @brief Creates the settings and extras.
|
|
void initialize_settings_extras();
|
|
|
|
/// @brief Pushes the icons to the main menu.
|
|
void initialize_menu();
|
|
|
|
/// @brief Initializes the data struct.
|
|
void initialize_data_struct();
|
|
|
|
/// @brief Pushes the target state to the vector.
|
|
void push_target_state();
|
|
|
|
/// @brief Creates the user option state.
|
|
void create_user_options();
|
|
|
|
/// @brief Backups up all save data for all users.
|
|
void backup_all_for_all();
|
|
};
|