diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-18 01:49:47 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-18 01:49:47 +0000 |
| commit | 3fb0a02954fd427f760afe29ef71591dba542454 (patch) | |
| tree | 2fdf45d83ca16dca0a372b5b149cbbe79719decf /src/game | |
| parent | 4ad19387e4d91af5d85953bcc45096f2618f6887 (diff) | |
| download | zcatch-3fb0a02954fd427f760afe29ef71591dba542454.tar.gz zcatch-3fb0a02954fd427f760afe29ef71591dba542454.zip | |
fixed chat rendering
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/gc_client.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 48712e5d..ed26427d 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -1182,7 +1182,7 @@ void render_game() { gfx_mapscreen(0,0,300*gfx_screenaspect(),300); float x = 10.0f; - float y = 300.0f-50.0f; + float y = 300.0f-30.0f; float starty = -1; if(chat_mode != CHATMODE_NONE) { @@ -1209,6 +1209,16 @@ void render_game() float begin = x; + + float fontsize = 8.0f; + + // turn of alpha so we can render once and just get the number of lines + // TODO: this is ugly, but have to do for now + gfx_text_color(1,1,1,0); + int lines = gfx_text(0, begin, y, fontsize, chat_lines[r].text, 300); + + y -= fontsize * (lines); + // render name gfx_text_color(0.8f,0.8f,0.8f,1); if(chat_lines[r].client_id == -1) @@ -1223,10 +1233,13 @@ void render_game() gfx_text_color(0.75f,0.5f,0.75f, 1); // spectator // render line - int lines = int(gfx_text_width(0, 10, chat_lines[r].text, -1)) / 300 + 1; - gfx_text(0, begin, y - 8 * (lines - 1), 8, chat_lines[r].name, -1); - begin += gfx_text_width(0, 10, chat_lines[r].name, -1); + //int lines = int(gfx_text_width(0, fontsize, chat_lines[r].text, -1)) / 300 + 1; + + + gfx_text(0, begin, y, fontsize, chat_lines[r].name, -1); + begin += gfx_text_width(0, fontsize, chat_lines[r].name, -1); + gfx_text_color(1,1,1,1); if(chat_lines[r].client_id == -1) @@ -1234,8 +1247,7 @@ void render_game() else if(chat_lines[r].team) gfx_text_color(0.65f,1,0.65f,1); // team message - gfx_text(0, begin, y - 8 * (lines - 1), 8, chat_lines[r].text, 300); - y -= 6 * lines; + gfx_text(0, begin, y, fontsize, chat_lines[r].text, 300); } gfx_text_color(1,1,1,1); |