mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-09-12 20:45:11 -05:00
More refactoring. Add error::
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "appstates/BaseTask.hpp"
|
||||
|
||||
#include "colors.hpp"
|
||||
|
||||
namespace
|
||||
@@ -7,31 +8,28 @@ namespace
|
||||
constexpr uint64_t TICKS_GLYPH_TRIGGER = 50;
|
||||
} // namespace
|
||||
|
||||
BaseTask::BaseTask() : BaseState(false)
|
||||
BaseTask::BaseTask()
|
||||
: BaseState(false)
|
||||
{
|
||||
m_frameTimer.start(TICKS_GLYPH_TRIGGER);
|
||||
}
|
||||
|
||||
void BaseTask::update()
|
||||
{
|
||||
// Just bail if the timer wasn't triggered yet.
|
||||
if (!m_frameTimer.is_triggered())
|
||||
if (!m_task->is_running())
|
||||
{
|
||||
BaseState::deactivate();
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset to 0 here.
|
||||
if (++m_currentFrame >= 8)
|
||||
{
|
||||
m_currentFrame = 0;
|
||||
}
|
||||
|
||||
// Update the color pulse.
|
||||
// Just bail if the timer wasn't triggered yet.
|
||||
if (!m_frameTimer.is_triggered()) { return; }
|
||||
if (++m_currentFrame >= 8) { m_currentFrame = 0; }
|
||||
m_colorMod.update();
|
||||
}
|
||||
|
||||
void BaseTask::render_loading_glyph()
|
||||
{
|
||||
// This assumes it's being called after the background was dimmed.
|
||||
sdl::text::render(NULL, 56, 673, 32, sdl::text::NO_TEXT_WRAP, m_colorMod, sm_glyphArray.at(m_currentFrame).data());
|
||||
const char *currentFrame = sm_glyphArray.at(m_currentFrame).data();
|
||||
sdl::text::render(NULL, 56, 673, 32, sdl::text::NO_TEXT_WRAP, m_colorMod, currentFrame);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user