mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
made mouse wheel change speed in demo player. Closes #524
This commit is contained in:
parent
5060f42b63
commit
2aa1bda97e
|
@ -135,6 +135,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
DemoPlayer()->SetPos(0);
|
DemoPlayer()->SetPos(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IncreaseDemoSpeed = false, DecreaseDemoSpeed = false;
|
||||||
|
|
||||||
if(m_MenuActive)
|
if(m_MenuActive)
|
||||||
{
|
{
|
||||||
// do buttons
|
// do buttons
|
||||||
|
@ -170,33 +172,15 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static int s_SlowDownButton = 0;
|
static int s_SlowDownButton = 0;
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_SlowDownButton, SPRITE_DEMOBUTTON_SLOWER, 0, &Button))
|
if(DoButton_DemoPlayer_Sprite(&s_SlowDownButton, SPRITE_DEMOBUTTON_SLOWER, 0, &Button) || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||||
{
|
DecreaseDemoSpeed = true;
|
||||||
if(pInfo->m_Speed > 4.0f) DemoPlayer()->SetSpeed(4.0f);
|
|
||||||
else if(pInfo->m_Speed > 2.0f) DemoPlayer()->SetSpeed(2.0f);
|
|
||||||
else if(pInfo->m_Speed > 1.0f) DemoPlayer()->SetSpeed(1.0f);
|
|
||||||
else if(pInfo->m_Speed > 0.75f) DemoPlayer()->SetSpeed(0.75f);
|
|
||||||
else if(pInfo->m_Speed > 0.5f) DemoPlayer()->SetSpeed(0.5f);
|
|
||||||
else if(pInfo->m_Speed > 0.25f) DemoPlayer()->SetSpeed(0.25f);
|
|
||||||
else if(pInfo->m_Speed > 0.1f) DemoPlayer()->SetSpeed(0.1f);
|
|
||||||
else DemoPlayer()->SetSpeed(0.05f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fastforward
|
// fastforward
|
||||||
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
ButtonBar.VSplitLeft(Margins, 0, &ButtonBar);
|
||||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static int s_FastForwardButton = 0;
|
static int s_FastForwardButton = 0;
|
||||||
if(DoButton_DemoPlayer_Sprite(&s_FastForwardButton, SPRITE_DEMOBUTTON_FASTER, 0, &Button))
|
if(DoButton_DemoPlayer_Sprite(&s_FastForwardButton, SPRITE_DEMOBUTTON_FASTER, 0, &Button))
|
||||||
{
|
IncreaseDemoSpeed = true;
|
||||||
if(pInfo->m_Speed < 0.1f) DemoPlayer()->SetSpeed(0.1f);
|
|
||||||
else if(pInfo->m_Speed < 0.25f) DemoPlayer()->SetSpeed(0.25f);
|
|
||||||
else if(pInfo->m_Speed < 0.5f) DemoPlayer()->SetSpeed(0.5f);
|
|
||||||
else if(pInfo->m_Speed < 0.75f) DemoPlayer()->SetSpeed(0.75f);
|
|
||||||
else if(pInfo->m_Speed < 1.0f) DemoPlayer()->SetSpeed(1.0f);
|
|
||||||
else if(pInfo->m_Speed < 2.0f) DemoPlayer()->SetSpeed(2.0f);
|
|
||||||
else if(pInfo->m_Speed < 4.0f) DemoPlayer()->SetSpeed(4.0f);
|
|
||||||
else DemoPlayer()->SetSpeed(8.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// speed meter
|
// speed meter
|
||||||
ButtonBar.VSplitLeft(Margins*3, 0, &ButtonBar);
|
ButtonBar.VSplitLeft(Margins*3, 0, &ButtonBar);
|
||||||
|
@ -221,6 +205,29 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
Cursor.m_LineWidth = MainView.w;
|
Cursor.m_LineWidth = MainView.w;
|
||||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(IncreaseDemoSpeed || Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||||
|
{
|
||||||
|
if(pInfo->m_Speed < 0.1f) DemoPlayer()->SetSpeed(0.1f);
|
||||||
|
else if(pInfo->m_Speed < 0.25f) DemoPlayer()->SetSpeed(0.25f);
|
||||||
|
else if(pInfo->m_Speed < 0.5f) DemoPlayer()->SetSpeed(0.5f);
|
||||||
|
else if(pInfo->m_Speed < 0.75f) DemoPlayer()->SetSpeed(0.75f);
|
||||||
|
else if(pInfo->m_Speed < 1.0f) DemoPlayer()->SetSpeed(1.0f);
|
||||||
|
else if(pInfo->m_Speed < 2.0f) DemoPlayer()->SetSpeed(2.0f);
|
||||||
|
else if(pInfo->m_Speed < 4.0f) DemoPlayer()->SetSpeed(4.0f);
|
||||||
|
else DemoPlayer()->SetSpeed(8.0f);
|
||||||
|
}
|
||||||
|
else if(DecreaseDemoSpeed || Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||||
|
{
|
||||||
|
if(pInfo->m_Speed > 4.0f) DemoPlayer()->SetSpeed(4.0f);
|
||||||
|
else if(pInfo->m_Speed > 2.0f) DemoPlayer()->SetSpeed(2.0f);
|
||||||
|
else if(pInfo->m_Speed > 1.0f) DemoPlayer()->SetSpeed(1.0f);
|
||||||
|
else if(pInfo->m_Speed > 0.75f) DemoPlayer()->SetSpeed(0.75f);
|
||||||
|
else if(pInfo->m_Speed > 0.5f) DemoPlayer()->SetSpeed(0.5f);
|
||||||
|
else if(pInfo->m_Speed > 0.25f) DemoPlayer()->SetSpeed(0.25f);
|
||||||
|
else if(pInfo->m_Speed > 0.1f) DemoPlayer()->SetSpeed(0.1f);
|
||||||
|
else DemoPlayer()->SetSpeed(0.05f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CUIRect gs_ListBoxOriginalView;
|
static CUIRect gs_ListBoxOriginalView;
|
||||||
|
|
Loading…
Reference in a new issue