diff options
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index de867c0..e7704f2 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -210,6 +210,7 @@ View::View(ui::Widget *parent) : ui::Widget(parent) view_keypress = new KeyPress(this); view_notify = new Notifications(this); view_chat = new Chat(this); + view_map = new Map(this); // make sure the view is at the bottom of the draw stack lower(); @@ -232,6 +233,10 @@ void View::resize() view_keypress->set_location(width() - view_keypress->width() - font()->width() * 0.5, height() - view_keypress->height() - font()->height() * 0.5f); + // reposition map + view_map->set_size(width() - font()->width() * 8, height() - font()->height() * 8); + view_map->set_location(font()->width() * 4, font()->height() * 4); + // reposition center view_center->set_size(ui::pointer_size, ui::pointer_size); view_center->set_location((size() - view_center->size()) * 0.5f); @@ -268,6 +273,9 @@ void View::draw() } } else { view_notify->set_visible(false); + + view_chat->set_visible(false); + view_map->set_visible(false); } if (core::localcontrol() && (input::mouse_control || input::joystick_control) && @@ -462,18 +470,18 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) // outer square shadow gl::color(0, 0, 0, 1); gl::begin(gl::LineLoop); - glVertex3f(cx+r, cy+2, 0); - glVertex3f(cx, cy+r+2, 0); - glVertex3f(cx-r, cy+2, 0); - glVertex3f(cx, cy-r+2, 0); + gl::vertex(cx+r, cy+2); + gl::vertex(cx, cy+r+2); + gl::vertex(cx-r, cy+2); + gl::vertex(cx, cy-r+2); gl::end(); if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) { gl::begin(gl::LineLoop); - glVertex3f(cx+ (r*0.25f), cy+2, 0); - glVertex3f(cx, cy+(r*0.25f)+2, 0); - glVertex3f(cx-(r*0.25f), cy+2, 0); - glVertex3f(cx, cy-(r*0.25f)+2, 0); + gl::vertex(cx+ (r*0.25f), cy+2); + gl::vertex(cx, cy+(r*0.25f)+2); + gl::vertex(cx-(r*0.25f), cy+2); + gl::vertex(cx, cy-(r*0.25f)+2); gl::end(); } @@ -487,18 +495,18 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) // outer square0 gl::begin(gl::LineLoop); - glVertex3f(cx+r, cy, 0); - glVertex3f(cx, cy+r, 0); - glVertex3f(cx-r, cy, 0); - glVertex3f(cx, cy-r, 0); + gl::vertex(cx+r, cy); + gl::vertex(cx, cy+r); + gl::vertex(cx-r, cy); + gl::vertex(cx, cy-r); gl::end(); if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) { gl::begin(gl::LineLoop); - glVertex3f(cx+(r*0.25f), cy, 0); - glVertex3f(cx, cy+(r*0.25f), 0); - glVertex3f(cx-(r*0.25f), cy, 0); - glVertex3f(cx, cy-(r*0.25f), 0); + gl::vertex(cx+(r*0.25f), cy); + gl::vertex(cx, cy+(r*0.25f)); + gl::vertex(cx-(r*0.25f), cy); + gl::vertex(cx, cy-(r*0.25f)); gl::end(); } @@ -682,7 +690,7 @@ void draw_hud() } } -void draw_cursor() +void set_cursor() { if (ui::console()->visible()) { ui::root()->set_pointer(); @@ -757,9 +765,6 @@ void frame(float elapsed) // draw the user interface if (draw_ui->value()) { - draw_cursor(); - ui::root()->frame(); - // draw the hud - TODO move as much as possible into ui:: if (draw_ui->value() && !ui::root()->active()) { gl::enable(GL_TEXTURE_2D); @@ -769,6 +774,10 @@ void frame(float elapsed) // draw the hud draw_hud(); } + + set_cursor(); + ui::root()->frame(); + } else if (ui::console()->visible()) { ui::console()->event_draw(); } |