From cc18095cded14f5e7e3f049e47fca2224134b647 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 19 Sep 2010 19:44:13 +0000 Subject: text rendering cleanups, inventory capacity & cargo volume --- src/client/hud.cc | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/client/hud.cc') diff --git a/src/client/hud.cc b/src/client/hud.cc index 3a7601b..d712987 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -28,7 +28,7 @@ HUD::HUD(ui::Widget *parent) : Widget(parent) hud_toolbar->add_button("", "Chat", "ui_chat"); hud_toolbar->add_button("", "Map", "ui_map"); */ - hud_center = new ui::Bitmap(this, "pointers/center"); + hud_center = new ui::Bitmap(this, "bitmaps/pointers/center"); hud_center->set_color(palette()->pointer()); } @@ -180,7 +180,7 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) if (is_active_target) { // entity name and distance - std::stringstream strdistance; + std::ostringstream strdistance; float d = math::distance(core::localcontrol()->location(), entity->location()) - entity->radius() - core::localcontrol()->radius(); if (d > 0) { if (d > 100.0f) { @@ -213,7 +213,7 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) cy - r - 4 - render::Text::fontheight(), entity->name()); render::Text::draw(cx - aux::text_length(strdistance.str()) * render::Text::fontwidth() * 0.5f, - cy + r + 4, strdistance); + cy + r + 4, strdistance.str()); } } @@ -235,7 +235,6 @@ bool HUD::on_keypress(const int key, const unsigned int modifier) void HUD::draw() { using namespace render; - std::stringstream status; if (core::localcontrol() && (input::mouse_control || input::joystick_control) && (render::Camera::mode() == render::Camera::Cockpit || render::Camera::mode() == render::Camera::Track)) { @@ -248,7 +247,6 @@ void HUD::draw() Text::setfont("gui", 12, 18); Text::setcolor('N'); //set normal color - core::Zone *zone = core::localcontrol()->zone(); // draw HUD targets @@ -269,7 +267,7 @@ void HUD::draw() /* unsigned int state = core::localcontrol()->state(); if (state) { - std::stringstream statestr; + std::ostringstream statestr; statestr.clear(); if (state == core::Entity::ImpulseInitiate) { statestr << "^FInitializing kinetic impulse drive " << core::localcontrol()->timer(); @@ -281,15 +279,13 @@ void HUD::draw() statestr << "^FJumping..."; } - Text::draw(4, render::State::height() - Text::fontheight()*3 - 4, statestr); + Text::draw(4, render::State::height() - Text::fontheight()*3 - 4, statestr.str()); } */ const core::Entity *target = targets::current(); - std::stringstream strdistance; - if (target) { - std::stringstream strtarget; + std::ostringstream strtarget; strtarget << "^B" << target->name() << "\n^B"; float d = math::distance(core::localcontrol()->location(), target->location()) @@ -316,15 +312,15 @@ void HUD::draw() } else { strtarget << " --"; } - strtarget << '\n'; - Text::draw(width() - 4 - Text::fontwidth()*30, height() - Text::fontheight()*2 - 4, strtarget); + Text::draw(width() - 4 - Text::fontwidth()*30, height() - Text::fontheight()*2 - 4, strtarget.str()); } // draw player info - std::stringstream playerinfostr; + std::ostringstream playerinfostr; playerinfostr << "^B" << core::localcontrol()->name() << '\n' << "^Ncredits: " << core::localplayer()->credits(); - Text::draw(width() - 4 - Text::fontwidth()*52, height() - Text::fontheight()*2 - 4, playerinfostr); + Text::draw(width() - 4 - Text::fontwidth()*52, height() - Text::fontheight()*2 - 4, playerinfostr.str()); + // draw thruster indicator Textures::bind("bitmaps/hud/thruster_base"); // 316 x 32 bitmap gl::color(1, 1, 1, 1); gl::begin(gl::Quads); @@ -388,9 +384,9 @@ void HUD::draw() Text::setfont("gui", 14, 24); Text::setcolor('B'); //set normal color - std::stringstream speedstr; + std::ostringstream speedstr; speedstr << "^B" << roundf(core::localcontrol()->speed() * 100.0f); - Text::draw(316 + 4 + 10, height() - 6 - 16 - render::Text::fontwidth() / 2, speedstr); + Text::draw(316 + 4 + 10, height() - 6 - 16 - render::Text::fontwidth() / 2, speedstr.str()); Text::setfont("gui", 12, 18); Text::setcolor('N'); //set normal color -- cgit v1.2.3