about summary refs log tree commit diff
path: root/src/game/client/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/broadcast.cpp11
-rw-r--r--src/game/client/components/broadcast.h5
2 files changed, 12 insertions, 4 deletions
diff --git a/src/game/client/components/broadcast.cpp b/src/game/client/components/broadcast.cpp
index 7908c2db..a4940ed7 100644
--- a/src/game/client/components/broadcast.cpp
+++ b/src/game/client/components/broadcast.cpp
@@ -21,8 +21,10 @@ void CBroadcast::OnRender()
 		
 	if(time_get() < m_BroadcastTime)
 	{
-		float w = TextRender()->TextWidth(0, 14, m_aBroadcastText, -1);
-		TextRender()->Text(0, 150*Graphics()->ScreenAspect()-w/2, 35, 14, m_aBroadcastText, -1);
+		CTextCursor Cursor;
+		TextRender()->SetCursor(&Cursor, m_BroadcastRenderOffset, 40.0f, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
+		Cursor.m_LineWidth = 300*Graphics()->ScreenAspect()-2*m_BroadcastRenderOffset;
+		TextRender()->TextEx(&Cursor, m_aBroadcastText, -1);
 	}
 }
 
@@ -32,6 +34,11 @@ void CBroadcast::OnMessage(int MsgType, void *pRawMsg)
 	{
 		CNetMsg_Sv_Broadcast *pMsg = (CNetMsg_Sv_Broadcast *)pRawMsg;
 		str_copy(m_aBroadcastText, pMsg->m_pMessage, sizeof(m_aBroadcastText));
+		CTextCursor Cursor;
+		TextRender()->SetCursor(&Cursor, 0, 0, 12.0f, TEXTFLAG_STOP_AT_END);
+		Cursor.m_LineWidth = 300*Graphics()->ScreenAspect();
+		TextRender()->TextEx(&Cursor, m_aBroadcastText, -1);
+		m_BroadcastRenderOffset = 150*Graphics()->ScreenAspect()-Cursor.m_X/2;
 		m_BroadcastTime = time_get()+time_freq()*10;
 	}
 }
diff --git a/src/game/client/components/broadcast.h b/src/game/client/components/broadcast.h
index c580ce28..47c66616 100644
--- a/src/game/client/components/broadcast.h
+++ b/src/game/client/components/broadcast.h
@@ -6,11 +6,12 @@
 
 class CBroadcast : public CComponent
 {
-public:
 	// broadcasts
 	char m_aBroadcastText[1024];
 	int64 m_BroadcastTime;
-	
+	float m_BroadcastRenderOffset;
+
+public:
 	virtual void OnReset();
 	virtual void OnRender();
 	virtual void OnMessage(int MsgType, void *pRawMsg);