JKSV/include/appstates/TitleInfoState.hpp

68 lines
2.1 KiB
C++

#pragma once
#include "StateManager.hpp"
#include "appstates/BaseState.hpp"
#include "data/data.hpp"
#include "sys/sys.hpp"
#include "ui/ui.hpp"
#include <memory>
#include <string>
#include <vector>
class TitleInfoState final : public BaseState
{
public:
/// @brief Constructs a new title info state.
/// @param user User to display info for.
/// @param titleInfo Title to display info for.
TitleInfoState(data::User *user, data::TitleInfo *titleInfo);
/// @brief Creates a new TitleInfoState.
static inline std::shared_ptr<TitleInfoState> create(data::User *user, data::TitleInfo *titleInfo)
{
return std::make_shared<TitleInfoState>(user, titleInfo);
}
/// @brief Creates, pushes, and returns a new TitleInfoState.
static inline std::shared_ptr<TitleInfoState> create_and_push(data::User *user, data::TitleInfo *titleInfo)
{
auto newState = TitleInfoState::create(user, titleInfo);
StateManager::push_state(newState);
return newState;
}
/// @brief Runs update routine.
void update() override;
/// @brief Runs render routine.
void render() override;
private:
/// @brief Pointer to user.
data::User *m_user{};
/// @brief Pointer to title info.
data::TitleInfo *m_titleInfo{};
/// @brief This is a pointer to the title's icon.
sdl::SharedTexture m_icon{};
/// @brief This controls the clear color of the fields rendered.
bool m_fieldClear{};
/// @brief Slide panel.
static inline std::unique_ptr<ui::SlideOutPanel> sm_slidePanel{};
/// @brief Initializes the static members if they haven't been already.
void initialize_static_members();
/// @brief Creates the scrolling text/cheating fields.
void create_info_scrolls();
/// @brief Helper function for creating text fields.
std::shared_ptr<ui::TextScroll> create_new_scroll(std::string_view text, int y);
/// @brief Performs some operations and marks the state for purging.
void deactivate_state();
};