diff options
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 71 |
1 files changed, 9 insertions, 62 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index 7d11df3..0fa47d4 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -129,44 +129,36 @@ void draw_status() return; // print the status in the upper left corner - gl::color(1.0f, 1.0f, 1.0f, 1.0f); std::stringstream status; - - /* - int minutes = (int) floorf(core::application()->time() / 60.0f); - int seconds = (int) floorf(core::application()->time() - (float) minutes* 60.0f); - */ - + if (core::game()) { int minutes = (int) floorf(core::game()->clientframetime() / 60.0f); int seconds = (int) floorf( core::game()->clientframetime() - (float) minutes* 60.0f); - status << "time " << std::setfill('0') << std::setw(2) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; + status << "^Ntime ^B" << std::setfill('0') << std::setw(2) << minutes << "^N:^B" << std::setfill('0') << std::setw(2) << seconds; Text::draw(4, 4, status); } // print stats if desired if (draw_stats && draw_stats->value()) { std::stringstream stats; - stats << "fps " << std::setw(6) << fps << "\n"; + stats << "^Nfps ^B" << std::setw(6) << fps << "\n"; if (core::application()->connected()) { - stats << "tris " << std::setw(5) << render::Stats::tris << "\n"; - stats << "quads " << std::setw(5) << render::Stats::quads << "\n"; + stats << "^Ntris ^B" << std::setw(5) << render::Stats::tris << "\n"; + stats << "^Nquads ^B" << std::setw(5) << render::Stats::quads << "\n"; } - stats << "tx "<< std::setw(5) << (core::Stats::network_bytes_sent >> 10) << "\n"; - stats << "rx "<< std::setw(5) << (core::Stats::network_bytes_received >> 10) << "\n"; + stats << "^Ntx ^B"<< std::setw(5) << (core::Stats::network_bytes_sent >> 10) << "\n"; + stats << "^Nrx ^B"<< std::setw(5) << (core::Stats::network_bytes_received >> 10) << "\n"; Text::draw(video::width-Text::fontwidth()*12, video::height - Text::fontheight()*8, stats); } // 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 + status << "^Nthrust ^B" << std::setfill(' ') << std::setw(5) << std::fixed << std::setprecision(2) << core::localcontrol()->thrust() << " "; - status << "speed " << std::setfill(' ') << std::setw(5) << std::fixed + status << "^Nspeed ^B" << std::setfill(' ') << std::setw(5) << std::fixed << std::setprecision(2) << core::localcontrol()->speed(); Text::draw(4, video::height - Text::fontheight() -4, status); @@ -174,48 +166,6 @@ void draw_status() } -void draw_notify() -{ - using namespace render; - - if (console::visible()) - return; - - // draw notifications - gl::color(1.0f, 1.0f, 1.0f, 1.0f); - size_t width = (size_t) ((video::width - 8) / Text::fontwidth()); - size_t n = console::notify_pos % MAXNOTIFYLINES; - float h = 4 + 2*Text::fontheight(); - for (size_t l = 0; l < MAXNOTIFYLINES; l++) { - if (console::notify_text[n].size() > 2 && console::notify_time[n] + 4 > core::application()->time()) { - std::string line(console::notify_text[n]); - - if (line[0] == '?') - gl::color(0.7f,0.7f,0.7f, 1.0f); - else if (line[0] == '*') - gl::color(1.0f,1.0f,0.0f, 1.0f); - 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); - line.erase(0,2); - - std::deque<std::string> lines; - - while (line.size() > width) { - Text::draw(4, h, line.substr(0, width)); - line.erase(0, width); - h += Text::fontheight(); - } - if (line.size()) { - Text::draw(4, h, line); - h += Text::fontheight(); - } - } - n = (n+1) % MAXNOTIFYLINES; - } -} - void draw_cursor() { if (!core::localcontrol() || console::visible()) @@ -309,11 +259,8 @@ void frame(float seconds) } // draw text elements - - // FIXME width and height should be derived from texture size Text::setfont("bitmaps/fonts/console", 12, 18); console::draw(); - draw_notify(); chat::draw(); Text::setfont("bitmaps/fonts/gui", 16, 24); |