diff options
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index 8f01ad5..1ee50ed 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -132,6 +132,22 @@ void draw_status() std::setw(7) << core::localcontrol()->location().z; Text::draw(4, video::height - Text::fontheight()*2 -4, location); } + + core::Entity *entity = targets::current(); + if (entity) { + std::stringstream target; + target << "^B" << entity->name() << "\n"; + target << "^Ndist ^B"; + + math::Vector3f v = entity->state()->location() - core::localcontrol()->state()->location(); + float d = v.length() - entity->radius() - core::localcontrol()->radius(); + if (d > 0 ) + target << std::fixed << std::setprecision(2) << std::setfill(' ') << std::setw(8) << d; + else + target << " --"; + + Text::draw(video::width - 4-Text::fontwidth()*24, video::height - Text::fontheight()*2 -4, target); + } } } @@ -299,6 +315,7 @@ void frame(float seconds) if (core::application()->connected() && core::game()->serverframetime()) { render::draw(seconds); // draw the world + targets::draw(); } // switch to ortographic projection to draw the GUI @@ -336,11 +353,6 @@ void frame(float seconds) draw_cursor(); } - // render sound and gui targets - if (core::application()->connected() && core::game()->serverframetime()) { - targets::draw(); - } - Text::setfont("bitmaps/fonts/console", 12, 18); chat::draw(); console()->draw(); |