diff options
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index 3524403..3576b90 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -155,39 +155,47 @@ void draw_status() } stats << "tx "<< std::setw(5) << (core::Stats::network_bytes_sent >> 10) << "\n"; stats << "rx "<< std::setw(5) << (core::Stats::network_bytes_received >> 10) << "\n"; - draw_text(video::width-CHARWIDTH*12, 4, stats); + draw_text(video::width-CHARWIDTH*12, video::height - CHARHEIGHT*10, stats); } - /* - // print the version number in the upper right corner - gl::color(0.0f, 1.0f, 0.0f, 1.0f); - std::string version("ver. "); - 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 width = (size_t) (video::width / CHARWIDTH) -2; size_t n = console::notify_pos % MAXNOTIFYLINES; int h = 4 + CHARHEIGHT; for (size_t l = 0; l < MAXNOTIFYLINES; l++) { if (console::notify_text[n].size() > 2 && console::notify_time[n] + 4 > core::application()->time()) { - if (console::notify_text[n][0] == '?') + std::string line(console::notify_text[n]); + + if (line[0] == '?') gl::color(0.7f,0.7f,0.7f, 1.0f); - else if (console::notify_text[n][0] == '*') + else if (line[0] == '*') gl::color(1.0f,1.0f,0.0f, 1.0f); - else if (console::notify_text[n][0] == '!') + else if (line[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; + line.erase(0,2); + + std::deque<std::string> lines; + + while (line.size() > width) { + draw_text(CHARWIDTH, h, line.substr(0, width)); + line.erase(0, width); + h += CHARHEIGHT; + } + if (line.size()) { + draw_text(CHARWIDTH, h, line); + h += CHARHEIGHT; + } } n = (n+1) % MAXNOTIFYLINES; } // draw a basic HUD if (core::localcontrol()) { + gl::color(1.0f,1.0f,1.0f, 1.0f); + status.str(""); status << "thrust " << std::setfill(' ') << std::setw(5) << std::fixed << std::setprecision(2) << core::localcontrol()->thrust() << " "; |