mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
message_window: added selection changed anim to options
This commit is contained in:
parent
ef51f04d4f
commit
47b1f20679
3 changed files with 31 additions and 3 deletions
|
|
@ -80,6 +80,7 @@
|
|||
#include "SWA/Menu/MenuWindowBase.h"
|
||||
#include "SWA/Movie/MovieDisplayer.h"
|
||||
#include "SWA/Movie/MovieManager.h"
|
||||
#include "SWA/Object/Common/DashPanel/ObjDashPanel.h"
|
||||
#include "SWA/Player/Character/EvilSonic/EvilSonic.h"
|
||||
#include "SWA/Player/Character/EvilSonic/EvilSonicContext.h"
|
||||
#include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace SWA
|
||||
{
|
||||
class CObjDashPanel
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0xE8);
|
||||
be<float> m_FieldE8;
|
||||
be<float> m_Speed;
|
||||
};
|
||||
}
|
||||
|
|
@ -22,7 +22,9 @@ static bool g_isAwaitingResult = false;
|
|||
static bool g_isClosing = false;
|
||||
static bool g_isControlsVisible = false;
|
||||
|
||||
static double g_rowSelectionTime;
|
||||
static int g_selectedRowIndex;
|
||||
static int g_prevSelectedRowIndex;
|
||||
static int g_foregroundCount;
|
||||
|
||||
static bool g_upWasHeld;
|
||||
|
|
@ -208,7 +210,13 @@ void DrawButton(int rowIndex, float yOffset, float width, float height, std::str
|
|||
bool isSelected = rowIndex == g_selectedRowIndex;
|
||||
|
||||
if (isSelected)
|
||||
DrawSelectionContainer(min, max, true);
|
||||
{
|
||||
auto prevItemOffset = (g_prevSelectedRowIndex - g_selectedRowIndex) * height;
|
||||
auto animRatio = std::clamp((ImGui::GetTime() - g_rowSelectionTime) * 60.0 / 8.0, 0.0, 1.0);
|
||||
prevItemOffset *= pow(1.0 - animRatio, 3.0);
|
||||
|
||||
DrawSelectionContainer({ min.x, min.y + prevItemOffset }, { max.x, max.y + prevItemOffset }, true);
|
||||
}
|
||||
|
||||
auto fontSize = Scale(28);
|
||||
auto textSize = g_fntSeurat->CalcTextSizeA(fontSize, FLT_MAX, 0, text.c_str());
|
||||
|
|
@ -375,6 +383,8 @@ void MessageWindow::Draw()
|
|||
bool scrollUp = !g_upWasHeld && upIsHeld;
|
||||
bool scrollDown = !g_downWasHeld && downIsHeld;
|
||||
|
||||
auto prevSelectedRowIndex = g_selectedRowIndex;
|
||||
|
||||
if (scrollUp)
|
||||
{
|
||||
--g_selectedRowIndex;
|
||||
|
|
@ -391,14 +401,17 @@ void MessageWindow::Draw()
|
|||
if (scrollUp || scrollDown)
|
||||
{
|
||||
Game_PlaySound("sys_actstg_pausecursor");
|
||||
g_rowSelectionTime = ImGui::GetTime();
|
||||
g_prevSelectedRowIndex = prevSelectedRowIndex;
|
||||
g_joypadAxis.y = 0;
|
||||
}
|
||||
|
||||
g_upWasHeld = upIsHeld;
|
||||
g_downWasHeld = downIsHeld;
|
||||
|
||||
EButtonIcon selectIcon = EButtonIcon::A;
|
||||
EButtonIcon backIcon = EButtonIcon::B;
|
||||
auto selectIcon = EButtonIcon::A;
|
||||
auto backIcon = EButtonIcon::B;
|
||||
|
||||
if (isController || isKeyboard)
|
||||
{
|
||||
if (isKeyboard && !App::s_isInit)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue