mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +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);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static CButtonContainer s_OneMarkerBackButton;
|
static CButtonContainer s_OneMarkerBackButton;
|
||||||
if(DoButton_FontIcon(&s_OneMarkerBackButton, FONT_ICON_BACKWARD_STEP, 0, &Button, IGraphics::CORNER_ALL))
|
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--)
|
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)
|
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;
|
PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PositionToSeek = 0.0f;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerBackButton, &Button, Localize("Go back one marker"));
|
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerBackButton, &Button, Localize("Go back one marker"));
|
||||||
|
|
||||||
// one marker forward
|
// one marker forward
|
||||||
|
@ -541,6 +543,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||||
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
|
||||||
static CButtonContainer s_OneMarkerForwardButton;
|
static CButtonContainer s_OneMarkerForwardButton;
|
||||||
if(DoButton_FontIcon(&s_OneMarkerForwardButton, FONT_ICON_FORWARD_STEP, 0, &Button, IGraphics::CORNER_ALL))
|
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++)
|
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)
|
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;
|
PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PositionToSeek = 1.0f;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerForwardButton, &Button, Localize("Go forward one marker"));
|
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerForwardButton, &Button, Localize("Go forward one marker"));
|
||||||
|
|
||||||
// close button
|
// close button
|
||||||
|
|
Loading…
Reference in a new issue