diff options
author | Stijn Buys <ingar@osirion.org> | 2008-10-11 09:37:23 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-10-11 09:37:23 +0000 |
commit | 0d831968949b1119db48530a86c2d1651c6cbfc6 (patch) | |
tree | 925e02481149fa8ac227017af74818176b166a41 /src/client/view.cc | |
parent | 02fcd22d8cde355aa898a8c6bb4773d9434b8e9a (diff) |
zonechange events, menu previous command
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 78 |
1 files changed, 17 insertions, 61 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index 38d22d4..15f70bc 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -30,15 +30,16 @@ namespace client { -core::Cvar *draw_ui = 0; -core::Cvar *draw_stats = 0; -core::Cvar *draw_devinfo = 0; -core::Cvar *draw_keypress = 0; +core::Cvar *draw_ui = 0; +core::Cvar *draw_stats = 0; +core::Cvar *draw_devinfo = 0; +core::Cvar *draw_keypress = 0; -core::Cvar *ui_pointercolor = 0; -core::Cvar *ui_pointerhovercolor =0; +core::Cvar *ui_pointercolor = 0; +core::Cvar *ui_pointerhovercolor = 0; /* -- DevInfo------------------------------------------------------- */ + DevInfo::DevInfo(ui::Widget *parent) : ui::Widget(parent) { set_label("devinfo"); @@ -213,6 +214,8 @@ void View::draw() view_devinfo->set_visible(draw_devinfo->value() ? true : false); view_stats->set_visible(draw_stats->value() ? true : false); view_keypress->set_visible(draw_keypress->value() ? true : false); + + //draw_world(); } /* -- namespace view ----------------------------------------------- */ @@ -220,8 +223,6 @@ void View::draw() namespace view { -core::Zone *current_zone = 0; - void init() { // FIXME integrate with libui @@ -242,31 +243,6 @@ void shutdown() targets::shutdown(); } -void clear_zone(core::Zone *zone) -{ - if (!zone) { - current_zone = 0; - return; - } - - for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) { - core:: Entity *entity = (*it); - - if (entity->type() == core::Entity::Globe) { - core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity); - if (globe->render_texture) { - render::Textures::unload(globe->render_texture); - globe->render_texture = 0; - } - } - } - - if (zone->sky_texture()) { - render::Textures::unload(zone->sky_texture()); - zone->set_sky_texture(0); - } -} - /* FIXME should be merged with the render passes and in the bbox pass @@ -483,7 +459,7 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) } } -void draw_status() +void draw_hud() { using namespace render; std::stringstream status; @@ -525,32 +501,17 @@ void draw_status() } core::Entity *target = targets::current(); - float d = 0; std::stringstream strdistance; - - if (target) { - d = math::distance(core::localcontrol()->location(), target->state()->location()) - target->radius() - core::localcontrol()->radius(); - } -/* - if (draw_devinfo->value()) { - std::stringstream devinfo; - devinfo << std::fixed << std::setprecision(2) - << "^Nx:^B" << core::localcontrol()->location().x << " " - << "^Ny:^B" << core::localcontrol()->location().y << " " - << "^Nz:^B" << core::localcontrol()->location().z << '\n'; - - devinfo << "^Nthurst:^B " << core::localcontrol()->thrust() << " " - << "^Nspeed:^B " << core::localcontrol()->speed() << '\n'; - if (target) - devinfo << "^Ndist:^B " << d << '\n'; - Text::draw(4, 4 + Text::fontheight(), devinfo); - } -*/ + 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->state()->location()) + - target->radius() - core::localcontrol()->radius(); + if (d > 0 ) { strtarget << "^Ndist:^B "; if (d > 100.0f) { @@ -833,11 +794,6 @@ void frame(float seconds) render::Stats::clear(); if (core::application()->connected() && core::game()->serverframetime()) { - if (core::localplayer()->zone() != current_zone) { - if (current_zone) - clear_zone(current_zone); - current_zone = core::localplayer()->zone(); - } render::draw(seconds); // draw the world targets::draw(); // validate current target, render sound @@ -870,8 +826,8 @@ void frame(float seconds) if (draw_ui->value()) { Text::setfont("gui", 12, 18); - // draw the player status - draw_status(); + // draw the hud + draw_hud(); // draw the chat box chat::draw(); |