mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Also skip to beginning and end when there are no demo markers
Previously the buttons to skip to the next/previous demo marker were skipping to the end/beginning respectively, if there is no next/previous marker, but only if there were any map markers. Now the button immediately skip to the beginning/end also when there are no demo markers at all.
This commit is contained in:
parent
58156c12b9
commit
5501a33148
|
@ -525,6 +525,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||
static CButtonContainer s_OneMarkerBackButton;
|
||||
if(DoButton_FontIcon(&s_OneMarkerBackButton, FONT_ICON_BACKWARD_STEP, 0, &Button, IGraphics::CORNER_ALL))
|
||||
{
|
||||
PositionToSeek = 0.0f;
|
||||
for(int i = pInfo->m_NumTimelineMarkers - 1; i >= 0; i--)
|
||||
{
|
||||
if((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) < CurrentTick && absolute(((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) - CurrentTick)) > Threshold)
|
||||
|
@ -532,8 +534,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks;
|
||||
break;
|
||||
}
|
||||
PositionToSeek = 0.0f;
|
||||
}
|
||||
}
|
||||
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerBackButton, &Button, Localize("Go back one marker"));
|
||||
|
||||
// one marker forward
|
||||
|
@ -541,6 +543,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||
static CButtonContainer s_OneMarkerForwardButton;
|
||||
if(DoButton_FontIcon(&s_OneMarkerForwardButton, FONT_ICON_FORWARD_STEP, 0, &Button, IGraphics::CORNER_ALL))
|
||||
{
|
||||
PositionToSeek = 1.0f;
|
||||
for(int i = 0; i < pInfo->m_NumTimelineMarkers; i++)
|
||||
{
|
||||
if((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) > CurrentTick && absolute(((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) - CurrentTick)) > Threshold)
|
||||
|
@ -548,8 +552,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks;
|
||||
break;
|
||||
}
|
||||
PositionToSeek = 1.0f;
|
||||
}
|
||||
}
|
||||
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerForwardButton, &Button, Localize("Go forward one marker"));
|
||||
|
||||
// close button
|
||||
|
|
Loading…
Reference in a new issue