From c99a440e6fb1edf35e280f4df8ba22600e490535 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 26 Jan 2009 20:19:10 +0000 Subject: removed View class --- src/client/hud.cc | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'src/client/hud.cc') diff --git a/src/client/hud.cc b/src/client/hud.cc index c10ffa8..beeefd3 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -228,14 +228,6 @@ void HUD::draw() Text::setfont("gui", 12, 18); Text::setcolor('N'); //set normal color - // draw player info - std::stringstream playerinfostr; - playerinfostr << "^B" << core::localplayer()->name() << '\n' - <<"^B" << core::localcontrol()->name() << '\n' << "^N" - << "credits: " << core::localplayer()->credits(); - - Text::draw(Text::fontwidth() * 0.5f, Text::fontheight()*8+4, playerinfostr); - if(core::localplayer()->view()) { Text::setcolor('N'); //set normal color @@ -281,14 +273,12 @@ void HUD::draw() core::Entity *target = targets::current(); std::stringstream strdistance; - float d = 0; - float y = 1.0f; if (target) { std::stringstream strtarget; strtarget << "^B" << target->name() << "\n^B"; - d = math::distance(core::localcontrol()->location(), target->location()) + float d = math::distance(core::localcontrol()->location(), target->location()) - target->radius() - core::localcontrol()->radius(); if (d > 0 ) { @@ -313,28 +303,29 @@ void HUD::draw() strtarget << " --"; } strtarget << '\n'; - Text::draw(render::State::width() - 4-Text::fontwidth()*32, render::State::height() - Text::fontheight()*2 -4, strtarget); - y += 2.0f; + Text::draw(width() - 4-Text::fontwidth()*30, height() - Text::fontheight()*2 -4, strtarget); } - Text::setcolor('N'); //set normal color - Text::draw(render::State::width()-4-Text::fontwidth()*32, render::State::height()-Text::fontheight()*y-4, core::localcontrol()->zone()->name()); + // draw player info + std::stringstream playerinfostr; + playerinfostr <<"^B" << core::localcontrol()->name() << '\n' << "^Ncredits: " << core::localplayer()->credits(); + Text::draw(width() - 4-Text::fontwidth()*52, height() - Text::fontheight()*2 -4, playerinfostr); Textures::bind("bitmaps/hud/thruster_base"); // 316 x 32 bitmap gl::color(1, 1, 1, 1); gl::begin(gl::Quads); glTexCoord2f(0, 0); - gl::vertex(4, render::State::height() - 4 - 32, 0); + gl::vertex(4, height() - 4 - 32, 0); glTexCoord2f(1, 0); - gl::vertex(4 + 316, render::State::height() - 4 - 32, 0); + gl::vertex(4 + 316, height() - 4 - 32, 0); glTexCoord2f(1, 1); - gl::vertex(4 + 316, render::State::height() - 4 , 0); + gl::vertex(4 + 316, height() - 4 , 0); glTexCoord2f(0, 1); - gl::vertex(4, render::State::height() - 4 , 0); + gl::vertex(4, height() - 4 , 0); gl::end(); @@ -357,16 +348,16 @@ void HUD::draw() Textures::bind("bitmaps/hud/thruster_indicator"); // 316 x 32 bitmap gl::begin(gl::Quads); glTexCoord2f(0, 0); - gl::vertex(4, render::State::height() - 4 - 32, 0); + gl::vertex(4, height() - 4 - 32, 0); glTexCoord2f(u, 0); - gl::vertex(4.0f + u * 316.0f, render::State::height() - 4 - 32, 0); + gl::vertex(4.0f + u * 316.0f, height() - 4 - 32, 0); glTexCoord2f(u, 1); - gl::vertex(4.0f + u * 316.0f, render::State::height() - 4 , 0); + gl::vertex(4.0f + u * 316.0f, height() - 4 , 0); glTexCoord2f(0, 1); - gl::vertex(4, render::State::height() - 4 , 0); + gl::vertex(4, height() - 4 , 0); gl::end(); } @@ -376,7 +367,7 @@ void HUD::draw() std::stringstream speedstr; speedstr << "^B" << roundf(core::localcontrol()->speed() * 100.0f); - Text::draw( 316+4+10, render::State::height() - 6 -16 - render::Text::fontwidth() /2, speedstr); + Text::draw( 316+4+10, height() - 6 -16 - render::Text::fontwidth() /2, speedstr); Text::setfont("gui", 12, 18); Text::setcolor('N'); //set normal color -- cgit v1.2.3