From 5c734fe66e9ace93c03937adc2fc56336fb474fb Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 23 Feb 2008 17:10:35 +0000 Subject: client chatbox and message notifications --- src/client/view.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/client/view.cc') diff --git a/src/client/view.cc b/src/client/view.cc index 1a40c4a..3a9a8fb 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -6,6 +6,7 @@ #include "client/client.h" #include "client/camera.h" +#include "client/chat.h" #include "client/console.h" #include "client/video.h" #include "client/draw.h" @@ -121,6 +122,27 @@ void draw_status() version.append(core::version()); draw_text(video::width-(version.size()+1)*CHARWIDTH, 4, version); + // draw notifications + gl::color(1.0f, 1.0f, 1.0f, 1.0f); + size_t n = console::notify_pos % MAXNOTIFYLINES; + float now = sys::time(); + int h = 4 + CHARHEIGHT; + for (size_t l = 0; l < MAXNOTIFYLINES; l++) { + if (console::notify_text[n].size() > 2 && console::notify_time[n] + 5 > now) { + if (console::notify_text[n][0] == '?') + gl::color(0.7f,0.7f,0.7f, 1.0f); + else if (console::notify_text[n][0] == '*') + gl::color(1.0f,1.0f,0.0f, 1.0f); + else if (console::notify_text[n][0] == '!') + gl::color(1.0f,0.0f,0.0f, 1.0f); + else + gl::color(1.0f,1.0f,1.0f, 1.0f); + draw_text(CHARWIDTH, h, console::notify_text[n].substr(2)); + h += CHARHEIGHT; + } + n = (n+1) % MAXNOTIFYLINES; + } + gl::disable(GL_TEXTURE_2D); } @@ -134,6 +156,9 @@ void frame(float seconds) else fps = 9999; + // flush console messages + console::flush(); + // Clear the color and depth buffers. gl::clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -179,6 +204,7 @@ void frame(float seconds) // draw the console console::draw(); + chat::draw(); // draw the status line draw_status(); -- cgit v1.2.3