about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2012-04-21 00:23:48 +0200
committeroy <Tom_Adams@web.de>2013-02-24 17:34:51 +0100
commit86cd0cefd7cdefd7443cb9602b3c834fa85134e1 (patch)
treeb526caaba3fe6878589bade04932be253116af52 /src
parent14cd83de10e5725db6f159a9cfe8d0c8d7bd9b59 (diff)
downloadzcatch-86cd0cefd7cdefd7443cb9602b3c834fa85134e1.tar.gz
zcatch-86cd0cefd7cdefd7443cb9602b3c834fa85134e1.zip
fixed wrapping problems when rendering console input
Diffstat (limited to 'src')
-rw-r--r--src/engine/client/text.cpp2
-rw-r--r--src/game/client/components/console.cpp18
2 files changed, 13 insertions, 7 deletions
diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp
index af06fc11..d838ef29 100644
--- a/src/engine/client/text.cpp
+++ b/src/engine/client/text.cpp
@@ -639,7 +639,7 @@ public:
 					Compare.m_Y = DrawY;
 					Compare.m_Flags &= ~TEXTFLAG_RENDER;
 					Compare.m_LineWidth = -1;
-					TextEx(&Compare, pText, Wlen);
+					TextEx(&Compare, pCurrent, Wlen);
 
 					if(Compare.m_X-DrawX > pCursor->m_LineWidth)
 					{
diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp
index d16d56cd..01bf5351 100644
--- a/src/game/client/components/console.cpp
+++ b/src/game/client/components/console.cpp
@@ -434,12 +434,6 @@ void CGameConsole::OnRender()
 
 		x = Cursor.m_X;
 
-		// render console input (wrap line)
-		int Lines = TextRender()->TextLineCount(0, FontSize, pConsole->m_Input.GetString(), Screen.w - 10.0f - x);
-		y -= (Lines - 1) * FontSize;
-		TextRender()->SetCursor(&Cursor, x, y, FontSize, TEXTFLAG_RENDER);
-		Cursor.m_LineWidth = Screen.w - 10.0f - x;
-
 		//hide rcon password
 		char aInputString[256];
 		str_copy(aInputString, pConsole->m_Input.GetString(), sizeof(aInputString));
@@ -449,10 +443,22 @@ void CGameConsole::OnRender()
 				aInputString[i] = '*';
 		}
 
+		// render console input (wrap line)
+		TextRender()->SetCursor(&Cursor, x, y, FontSize, 0);
+		Cursor.m_LineWidth = Screen.w - 10.0f - x;
+		TextRender()->TextEx(&Cursor, aInputString, pConsole->m_Input.GetCursorOffset());
+		TextRender()->TextEx(&Cursor, aInputString+pConsole->m_Input.GetCursorOffset(), -1);
+		int Lines = Cursor.m_LineCount;
+		
+		y -= (Lines - 1) * FontSize;
+		TextRender()->SetCursor(&Cursor, x, y, FontSize, TEXTFLAG_RENDER);
+		Cursor.m_LineWidth = Screen.w - 10.0f - x;
+		
 		TextRender()->TextEx(&Cursor, aInputString, pConsole->m_Input.GetCursorOffset());
 		static float MarkerOffset = TextRender()->TextWidth(0, FontSize, "|", -1)/3;
 		CTextCursor Marker = Cursor;
 		Marker.m_X -= MarkerOffset;
+		Marker.m_LineWidth = -1;
 		TextRender()->TextEx(&Marker, "|", -1);
 		TextRender()->TextEx(&Cursor, aInputString+pConsole->m_Input.GetCursorOffset(), -1);