Implement/complete TitleInfoState

This commit is contained in:
J-D-K
2025-06-12 16:25:22 -04:00
parent 95ecbec3e4
commit 8dd16c12bc
12 changed files with 289 additions and 60 deletions

View File

@@ -6,6 +6,7 @@
#include "system/Timer.hpp"
#include "ui/Menu.hpp"
#include "ui/SlideOutPanel.hpp"
#include "ui/TextScroll.hpp"
#include <memory>
/// @brief This is the state where the user can backup and restore saves.
@@ -49,6 +50,9 @@ class BackupMenuState : public AppState
/// @brief Directory listing of the above.
fslib::Directory m_directoryListing;
/// @brief This is the scrolling text at the top.
ui::TextScroll m_titleScroll;
/// @brief Variable that saves whether or not the filesystem has data in it.
bool m_saveHasData = false;

View File

@@ -34,12 +34,36 @@ class TitleInfoState : public AppState
/// @brief This is a pointer to the title's icon.
sdl::SharedTexture m_icon;
/// @brief This is the scrolling text for the title.
ui::TextScroll m_titleScroll;
/// @brief This is the scrolling text for the publisher.
ui::TextScroll m_publisherScroll;
/// @brief This string holds the application ID.
std::string m_applicationID;
/// @brief This holds the hex save data id of the file on nand.
std::string m_saveDataID;
/// @brief This holds the play time string.
std::string m_playTime;
/// @brief This holds the total launches string.
std::string m_totalLaunches;
/// @brief This holds the save data type string.
std::string m_saveDataType;
/// @brief Bool to tell whether or not static members are initialized.
static inline bool sm_initialized = false;
/// @brief This is the render target for the title text just in case it needs scrolling.
static inline sdl::SharedTexture sm_titleTarget = nullptr;
/// @brief This is the render target for the publisher string.
static inline sdl::SharedTexture sm_publisherTarget = nullptr;
/// @brief Slide panel.
static inline std::unique_ptr<ui::SlideOutPanel> sm_slidePanel = nullptr;
};

View File

@@ -33,6 +33,7 @@ namespace strings
static constexpr std::string_view TITLE_OPTION_STATUS = "TitleOptionStatus";
static constexpr std::string_view TITLE_OPTION_POPS = "TitleOptionPops";
static constexpr std::string_view TITLE_OPTION_CONFIRMATIONS = "TitleOptionConfirmations";
static constexpr std::string_view TITLE_INFO_STRINGS = "TitleInfo";
static constexpr std::string_view POP_MESSAGES_GENERAL = "PopMessagesGeneral";
static constexpr std::string_view POP_MESSAGES_BACKUP_MENU = "PopMessagesBackupMenu";
static constexpr std::string_view POP_MESSAGES_SAVE_CREATE = "PopMessagesSaveCreate";

View File

@@ -15,11 +15,6 @@ namespace sys
/// @param triggerTicks Number of ticks the timer is triggered at.
Timer(uint64_t triggerTicks);
/// @brief Copy operator.
/// @param timer Timer to copy.
/// @return Reference to copied timer.
Timer &operator=(const Timer &timer);
/// @brief Starts the timer.
/// @param triggerTicks Number of ticks to trigger at.
void start(uint64_t triggerTicks);

View File

@@ -12,18 +12,26 @@ namespace ui
/// @brief This is only here so I can get around the backup menu having static members.
TextScroll(void) = default;
/// @brief Constructs a new TextScroll.
/// @param text Text to be scrolled.
/// @param availableWidth Maximum width. If this is not exceeded,text is just rendered centered according to it.
TextScroll(std::string_view text, int fontSize, int availableWidth, int y, sdl::Color color);
/// @brief Constructor for TextScroll.
/// @param text Text to create the textscroll with.
/// @param fontSize Size of the font in pixels to use.
/// @param availableWidth Available width of the render target.
/// @param y Y coordinate to render to.
/// @param center Whether or not text should be centered if it's not wide enough for scrolling.
/// @param color Color to use to render the text.
TextScroll(std::string_view text, int fontSize, int availableWidth, int y, bool center, sdl::Color color);
/// @brief Required destructor.
~TextScroll() {};
/// @brief Same as the default constructor. To do: Figure this out better sometime.
/// @param textScroll TextScroll to copy.
/// @return Reference to itself?
TextScroll &operator=(const TextScroll &textScroll);
/// @brief Creates/sets the text and parameters for TextScroll.
/// @param text Text to display/scroll.
/// @param fontSize Font size to use when rendering.
/// @param availableWidth Available width of the target buffer.
/// @param y Y coordinate used to render text.
/// @param center Whether or not text should be centered if it's not wide enough for scrolling.
/// @param color Color to use to render text.
void create(std::string_view text, int fontSize, int availableWidth, int y, bool center, sdl::Color color);
/// @brief Runs the update routine.
/// @param hasFocus Whether or not the calling state has focus.