about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2012-01-10 23:13:19 +0100
committeroy <Tom_Adams@web.de>2012-01-10 23:13:19 +0100
commitfa81141110ad46fc65860091c065bb932916fef4 (patch)
treef7d454da8e98b7befd559418ef2c44e42e050100 /src/game/client
parente8f9145a0dc097e7c1752f586049fd489a96d984 (diff)
downloadzcatch-fa81141110ad46fc65860091c065bb932916fef4.tar.gz
zcatch-fa81141110ad46fc65860091c065bb932916fef4.zip
added demo markers by Choupom. Closes #837
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/components/menus_demo.cpp17
-rw-r--r--src/game/client/ui.cpp5
-rw-r--r--src/game/client/ui.h1
3 files changed, 21 insertions, 2 deletions
diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp
index ec3e648c..40a9e5b5 100644
--- a/src/game/client/components/menus_demo.cpp
+++ b/src/game/client/components/menus_demo.cpp
@@ -86,15 +86,28 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
 		void *id = &s_SeekBarID;
 		char aBuffer[128];
 
+		// draw seek bar
 		RenderTools()->DrawUIRect(&SeekBar, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 5.0f);
 
+		// draw filled bar
 		float Amount = CurrentTick/(float)TotalTicks;
-
 		CUIRect FilledBar = SeekBar;
 		FilledBar.w = 10.0f + (FilledBar.w-10.0f)*Amount;
-
 		RenderTools()->DrawUIRect(&FilledBar, vec4(1,1,1,0.5f), CUI::CORNER_ALL, 5.0f);
 
+		// draw markers
+		for(int i = 0; i < pInfo->m_NumTimelineMarkers; i++)
+		{
+			float Ratio = (pInfo->m_aTimelineMarkers[i]-pInfo->m_FirstTick) / (float)TotalTicks;
+			Graphics()->TextureSet(-1);
+			Graphics()->QuadsBegin();
+			Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
+			IGraphics::CQuadItem QuadItem(SeekBar.x + (SeekBar.w-10.0f)*Ratio, SeekBar.y, UI()->PixelSize(), SeekBar.h);
+			Graphics()->QuadsDrawTL(&QuadItem, 1);
+			Graphics()->QuadsEnd();
+		}
+
+		// draw time
 		str_format(aBuffer, sizeof(aBuffer), "%d:%02d / %d:%02d",
 			CurrentTick/SERVER_TICK_SPEED/60, (CurrentTick/SERVER_TICK_SPEED)%60,
 			TotalTicks/SERVER_TICK_SPEED/60, (TotalTicks/SERVER_TICK_SPEED)%60);
diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp
index 00a30c15..c5219575 100644
--- a/src/game/client/ui.cpp
+++ b/src/game/client/ui.cpp
@@ -74,6 +74,11 @@ CUIRect *CUI::Screen()
 	return &m_Screen;
 }
 
+float CUI::PixelSize()
+{
+	return Screen()->w/Graphics()->ScreenWidth();
+}
+
 void CUI::SetScale(float s)
 {
 	g_Config.m_UiScale = (int)(s*100.0f);
diff --git a/src/game/client/ui.h b/src/game/client/ui.h
index 7cd78d6f..daba5d51 100644
--- a/src/game/client/ui.h
+++ b/src/game/client/ui.h
@@ -82,6 +82,7 @@ public:
 	void ConvertMouseMove(float *x, float *y);
 
 	CUIRect *Screen();
+	float PixelSize();
 	void ClipEnable(const CUIRect *pRect);
 	void ClipDisable();