made mouse wheel change speed in demo player. Closes #524

This commit is contained in:
oy 2011-03-27 16:26:50 +02:00
parent 5060f42b63
commit 2aa1bda97e

View file

@ -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;