mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-21 17:24:37 -05:00
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
#pragma once
|
|
#include "appstates/BaseState.hpp"
|
|
#include "system/Task.hpp"
|
|
#include "system/Timer.hpp"
|
|
#include "ui/ColorMod.hpp"
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
|
|
/// @brief Normally, I wouldn't do this, but this holds a single function both TaskState and ProgressState share...
|
|
class BaseTask : public BaseState
|
|
{
|
|
public:
|
|
/// @brief Constructor. Starts the glyph timer and sets AppState to not allow closing.
|
|
BaseTask();
|
|
|
|
/// @brief Virtual destructor.
|
|
virtual ~BaseTask() {};
|
|
|
|
/// @brief Runs the update routine for rendering the loading glyph animation.
|
|
/// @param
|
|
void update() override;
|
|
|
|
/// @brief Virtual render function.
|
|
virtual void render() = 0;
|
|
|
|
/// @brief This function renders the loading glyph in the bottom left corner.
|
|
/// @note This is mostly just so users don't think JKSV has frozen when operations take a long time.
|
|
void render_loading_glyph();
|
|
|
|
protected:
|
|
/// @brief Underlying system task. This needs to be allocated by the derived classes.
|
|
std::unique_ptr<sys::Task> m_task{};
|
|
|
|
private:
|
|
/// @brief This is the current frame of the loading glyph animation.
|
|
int m_currentFrame{};
|
|
|
|
/// @brief This is the timer used for changing the current glyph/frame of the animation.
|
|
sys::Timer m_frameTimer{};
|
|
|
|
/// @brief This is used to give the animation its pulsing color.
|
|
ui::ColorMod m_colorMod{};
|
|
|
|
/// @brief This is a pointer to the string popped when plus is pressed.
|
|
const char *m_popUnableExit{};
|
|
|
|
/// @brief This array holds the glyphs of the loading sequence. I think it's from the Wii?
|
|
static inline std::array<std::string_view, 8> sm_glyphArray =
|
|
{"\ue020", "\ue021", "\ue022", "\ue023", "\ue024", "\ue025", "\ue026", "\ue027"};
|
|
};
|