mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
More exact scrolling in Demo Player
This commit is contained in:
parent
b1d2d4f59e
commit
7465939054
|
@ -121,7 +121,12 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
{
|
||||
static float PrevAmount = 0.0f;
|
||||
float Amount = (UI()->MouseX()-SeekBar.x)/(float)SeekBar.w;
|
||||
if(Amount > 0.0f && Amount < 1.0f && absolute(PrevAmount-Amount) >= 0.01f)
|
||||
|
||||
if(Input()->KeyPressed(KEY_LSHIFT) || Input()->KeyPressed(KEY_RSHIFT))
|
||||
{
|
||||
Amount = PrevAmount + (Amount-PrevAmount) * 0.05f;
|
||||
|
||||
if(Amount > 0.0f && Amount < 1.0f && absolute(PrevAmount-Amount) >= 0.0001f)
|
||||
{
|
||||
PrevAmount = Amount;
|
||||
m_pClient->OnReset();
|
||||
|
@ -132,6 +137,20 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
m_pClient->m_pMapLayersForeGround->EnvelopeUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Amount > 0.0f && Amount < 1.0f && absolute(PrevAmount-Amount) >= 0.001f)
|
||||
{
|
||||
PrevAmount = Amount;
|
||||
m_pClient->OnReset();
|
||||
m_pClient->m_SuppressEvents = true;
|
||||
DemoPlayer()->SetPos(Amount);
|
||||
m_pClient->m_SuppressEvents = false;
|
||||
m_pClient->m_pMapLayersBackGround->EnvelopeUpdate();
|
||||
m_pClient->m_pMapLayersForeGround->EnvelopeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(UI()->HotItem() == id)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue