diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-25 11:57:39 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-25 11:57:39 +0000 |
commit | 72e2c3648345c8cede9db6b3348a492639ab2766 (patch) | |
tree | 5717d127aef3b0a7d7f94e09da2a226844381e52 /src/client | |
parent | cc88902f93645b4284805f51cd7eba8b513ed5f3 (diff) |
add player info to the HUD
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/hud.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/client/hud.cc b/src/client/hud.cc index 1eb2591..c10ffa8 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -195,6 +195,15 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) } else { render::Text::setcolor('N'); } + + // owner name + if (entity->type() == core::Entity::Controlable) { + const core::EntityControlable *ec = static_cast<core::EntityControlable *>(entity); + if (ec->owner()) { + render::Text::draw(cx-aux::text_length(entity->name()) * render::Text::fontwidth()*0.5f, + cy-r-4-2*render::Text::fontheight(), ec->owner()->name()); + } + } render::Text::draw(cx-aux::text_length(entity->name()) * render::Text::fontwidth()*0.5f, cy-r-4-render::Text::fontheight(), entity->name()); @@ -219,7 +228,15 @@ void HUD::draw() Text::setfont("gui", 12, 18); Text::setcolor('N'); //set normal color - // draw a basic HUD + // 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 Text::draw(render::State::width()-4-Text::fontwidth()*32, render::State::height()-Text::fontheight()*3-4, core::localcontrol()->zone()->name()); |