From 4123f28bbaa169ba8bb273f813fd7165e4f3a867 Mon Sep 17 00:00:00 2001 From: Fujnky Date: Fri, 3 Sep 2010 22:30:46 +0200 Subject: [PATCH] Improved demo player another bit. * Replaced the reset button by more common stop button * Made the demo player automatically reset after demo ended --- data/demo_buttons.png | Bin 599 -> 616 bytes datasrc/content.py | 2 +- src/game/client/components/menus_demo.cpp | 18 +++++++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/data/demo_buttons.png b/data/demo_buttons.png index 47a5c2f11e750612f6c080541a25921eb48d49a3..5f39410268da128de73d6c2031d0504bd2966c4c 100644 GIT binary patch delta 532 zcmV+v0_*+P1n2~iUw;T54ks4dNYuIj00HPpL_t(|+U=S>P6AOBh0i5Q2n1F@i92x% zZotCQgv!Rs&Wgm+!j<4oOx%Y`j?FUxoq0dQdv6fVmrTVS?tAxqL&D4eLI@#*5JCtc zgb+fAlZWJrrza|4SN_PD zx`sf_)aBB;*O;2rysJ9VFw_T<6A4&Hz@~FaPFxPHdyT2-ns-$vJj1;wIhKHR1a!yP z&E40}TazR2s!jw3ydilkp&4vK30L*nKHHo>K+wchY z*62hD0bc=JnAxS7z00YjpQd*JmjEu@982`*V{5HW41WqWd6Q0i@m5;I9>i;OVj%I3 zO2pSnQq^<9^EZ1x(~Q>EZp3E{k%0f@~-McU*btX@1wXz$x>^&=3Ui^zQmJ& zQ7`Nn5Y#^VxB9EvRh5aPru#t#eyYj*4t zers_)>al;wz52etbu1q^=BmpopPYV8;bnQCx?B2x<_Gl-jLk-T-|igQ>htXPv5L>m z*%Q9(ULo8kSHpZG_`uDb)zy9nxB9S_bZVTu4$<~umOjJot=twfH*bEvXx-DP4U_(e zn0ow*y~26Mm|+L=jdi{UPTp8++n)GtgA$9#)8#81Z@e$^b2!HEV4Cxha^VY#$9xsq z!VW9|>Qa!+te?XX^M&()u*3EOM(f?@(@#C?&kA_De`Z7GoB+LF+z+@CHajq`FRQnl zwZHSEf1um3(z$*$DZgG`lT6k-HsdnWdN+Nbq($nv^_}N9TVL8Xd_E+9FnzawN)^lM zPxrqF$~@zLU`+u>@P}H zVN+PdFWLz%h6Dmo>`&;N;HH-KkM{h$C8hFL?-kInDB%F5MQ#q~CGzVscqi3~moA!C zv6jo?tdzHamA{qSB>lCHm)_svD!VEy*>FVdQ&MBb@0CiIA ACjbBd diff --git a/datasrc/content.py b/datasrc/content.py index a11988b4c..92e71b96e 100644 --- a/datasrc/content.py +++ b/datasrc/content.py @@ -368,7 +368,7 @@ container.sprites.Add(Sprite("browse_unpure", set_browseicons, 3,0,1,1)) container.sprites.Add(Sprite("demobutton_play", set_demobuttons, 0,0,1,1)) container.sprites.Add(Sprite("demobutton_pause", set_demobuttons, 1,0,1,1)) -container.sprites.Add(Sprite("demobutton_reset", set_demobuttons, 2,0,1,1)) +container.sprites.Add(Sprite("demobutton_stop", set_demobuttons, 2,0,1,1)) container.sprites.Add(Sprite("demobutton_slower", set_demobuttons, 3,0,1,1)) container.sprites.Add(Sprite("demobutton_faster", set_demobuttons, 4,0,1,1)) diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index ef9ac62d1..82be758dc 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -59,6 +59,9 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) CUIRect SeekBar, ButtonBar; + int CurrentTick = pInfo->m_CurrentTick - pInfo->m_FirstTick; + int TotalTicks = pInfo->m_LastTick - pInfo->m_FirstTick; + if(m_MenuActive) { MainView.HSplitTop(SeekBarHeight, &SeekBar, &ButtonBar); @@ -75,9 +78,6 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) RenderTools()->DrawUIRect(&SeekBar, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 5.0f); - int CurrentTick = pInfo->m_CurrentTick - pInfo->m_FirstTick; - int TotalTicks = pInfo->m_LastTick - pInfo->m_FirstTick; - float Amount = CurrentTick/(float)TotalTicks; CUIRect FilledBar = SeekBar; @@ -120,7 +120,12 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) if(Inside) UI()->SetHotItem(id); } - + + if(CurrentTick == TotalTicks) + { + DemoPlayer()->Pause(); + DemoPlayer()->SetPos(0); + } if(m_MenuActive) { @@ -141,11 +146,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) DemoPlayer()->Unpause(); } + // stop button + ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static int s_ResetButton = 0; - if(DoButton_DemoPlayer_Sprite(&s_ResetButton, SPRITE_DEMOBUTTON_RESET, false, &Button)) + if(DoButton_DemoPlayer_Sprite(&s_ResetButton, SPRITE_DEMOBUTTON_STOP, false, &Button)) { + DemoPlayer()->Pause(); DemoPlayer()->SetPos(0); }