mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-09-12 12:35:26 -05:00
Add width and height to ui::Transition. Apply it to Message, Progress, Confirm states.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
MessageState::MessageState(std::string_view message)
|
||||
: m_message(message)
|
||||
, m_transition(280, 720, 280, 229, 4)
|
||||
, m_transition(0, 0, 32, 32, 0, 0, 720, 256, 4)
|
||||
{
|
||||
MessageState::initialize_static_members();
|
||||
}
|
||||
@@ -16,6 +16,7 @@ MessageState::MessageState(std::string_view message)
|
||||
void MessageState::update()
|
||||
{
|
||||
m_transition.update();
|
||||
sm_dialog->set_from_transition(m_transition, true);
|
||||
if (!m_transition.in_place()) { return; }
|
||||
|
||||
// To do: I only use this in one place right now. I'm not sure this guards correctly here?
|
||||
@@ -29,12 +30,13 @@ void MessageState::update()
|
||||
|
||||
void MessageState::render()
|
||||
{
|
||||
const bool hasFocus = BaseState::has_focus();
|
||||
const int y = m_transition.get_y();
|
||||
sm_dialog->set_y(y);
|
||||
static constexpr int y = 229;
|
||||
const bool hasFocus = BaseState::has_focus();
|
||||
|
||||
sdl::render_rect_fill(sdl::Texture::Null, 0, 0, 1280, 720, colors::DIM_BACKGROUND);
|
||||
sm_dialog->render(sdl::Texture::Null, hasFocus);
|
||||
if (!m_transition.in_place()) { return; }
|
||||
|
||||
sdl::text::render(sdl::Texture::Null, 312, y + 24, 20, 656, colors::WHITE, m_message);
|
||||
sdl::render_line(sdl::Texture::Null, 280, y + 192, 999, y + 192, colors::DIV_COLOR);
|
||||
sdl::text::render(sdl::Texture::Null, sm_okX, y + 214, 22, sdl::text::NO_WRAP, colors::WHITE, sm_okText);
|
||||
@@ -47,13 +49,15 @@ void MessageState::initialize_static_members()
|
||||
|
||||
sm_okText = strings::get_by_name(strings::names::YES_NO_OK, 2);
|
||||
sm_okX = HALF_WIDTH - (sdl::text::get_width(22, sm_okText) / 2);
|
||||
sm_dialog = ui::DialogBox::create(280, 262, 720, 256);
|
||||
sm_dialog = ui::DialogBox::create(0, 0, 0, 0);
|
||||
sm_dialog->set_from_transition(m_transition, true);
|
||||
}
|
||||
|
||||
void MessageState::close_dialog()
|
||||
{
|
||||
m_close = true;
|
||||
m_transition.set_target_y(720);
|
||||
m_transition.set_target_width(32);
|
||||
m_transition.set_target_height(32);
|
||||
}
|
||||
|
||||
void MessageState::deactivate_state()
|
||||
|
||||
Reference in New Issue
Block a user