From 69eed715f80c24c2435c82bb9fa1954697bf3af0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 4 Sep 2011 17:54:51 +0000 Subject: Moved main menu infrastructure into client namespace, removed ui::Container and ui::Menu classes. --- src/client/mapwindow.cc | 169 +----------------------------------------------- 1 file changed, 1 insertion(+), 168 deletions(-) (limited to 'src/client/mapwindow.cc') diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc index f1de585..244056b 100644 --- a/src/client/mapwindow.cc +++ b/src/client/mapwindow.cc @@ -151,173 +151,6 @@ void MapWindow::draw() set_target(mapwindow_target); } } - - /* - const float fontmargin = mapwindow_targetlabel->font()->height(); - const float s = ui::UI::elementsize.width() * 1.5f; - - const float blue = 0.8f; - const float gridsize = 16; - - const core::Entity *entity; - const core::Entity *current_target = mapwindow_target; - mapwindow_target = 0; - - math::Color color; - - math::Vector2f v(global_location()); - math::Vector2f l; - - v[0] += fontmargin; - v[1] += fontmargin + (height() - s) * 0.5f; - mapwindow_hover = 0; - - gl::color(0, 0, blue); - - gl::begin(gl::Lines); - for (int i = 0; i <= gridsize; i++) { - gl::vertex(v.x(), v.y() + s / gridsize * i); - gl::vertex(v.x() + s, v.y() + s / gridsize * i); - - gl::vertex(v.x() + s / gridsize * i, v.y()); - gl::vertex(v.x() + s / gridsize * i, v.y() + s); - } - gl::end(); - - const size_t texture_entity = render::Textures::load("bitmaps/icons/entity_default"); - const size_t texture_globe = render::Textures::load("bitmaps/icons/entity_globe"); - const size_t texture_bright = render::Textures::load("bitmaps/icons/entity_bright"); - - size_t texture_current = render::Textures::bind(texture_entity); - - v[0] += s * 0.5f; - v[1] += s * 0.5f; - - core::Zone *zone = core::localplayer()->zone(); - - mapwindow_maplabel->set_text(zone->name()); - - const math::Vector2f cursor(input::mouse_position_x(), input::mouse_position_y()); - - const float r = 12.0f; - float scale = 2048.0f; - scale *= 2; - - gl::enable(GL_TEXTURE_2D); - gl::begin(gl::Quads); - - // draw map icons - for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) { - entity = (*it); - - bool draw_icon = false; - l.assign(v); - - if (targets::is_valid_map_target(entity)) { - draw_icon = true; - l[0] -= s / scale * entity->location().y(); - l[1] -= s / scale * entity->location().x(); - - if (math::distancesquared(cursor, l) < (r*r)) { - mapwindow_hover = entity->id(); - } - - if (entity == current_target) { - mapwindow_target = entity; - if (core::application()->time() - floorf(core::application()->time()) < 0.5f) { - draw_icon = false; - } - } - } - - if (draw_icon) { - if (entity->type() == core::Entity::Globe) { - if (entity->flag_is_set(core::Entity::Bright)) { - if (texture_current != texture_bright) { - gl::end(); - texture_current = render::Textures::bind(texture_bright); - gl::begin(gl::Quads); - } - } else { - if (texture_current != texture_globe) { - gl::end(); - texture_current = render::Textures::bind(texture_globe); - gl::begin(gl::Quads); - } - } - } else { - if (texture_current != texture_entity) { - gl::end(); - texture_current = render::Textures::bind(texture_entity); - gl::begin(gl::Quads); - } - } - - if (entity == core::localplayer()->mission_target()) { - color.assign(palette()->mission()); - } else { - color.assign(entity->color()); - } - color.a = 1.0f; - - gl::color(color); - glTexCoord2f(0.0f, 0.0f); - gl::vertex(l.x() - r, l.y() - r); - - glTexCoord2f(1.0f, 0.0f); - gl::vertex(l.x() + r, l.y() - r); - - glTexCoord2f(1.0f, 1.0f); - gl::vertex(l.x() + r, l.y() + r); - - glTexCoord2f(0.0f, 1.0f); - gl::vertex(l.x() - r, l.y() + r); - } - - } - - // draw localcontrol icon - entity = core::localcontrol(); - - //if (core::localcontrol()->state() != core::Entity::Docked) { - l.assign(v); - l[0] -= s / scale * entity->location().y(); - l[1] -= s / scale * entity->location().x(); - if (core::application()->time() - floorf(core::application()->time()) < 0.5f) { - if (texture_current != texture_entity) { - gl::end(); - texture_current = render::Textures::bind(texture_entity); - gl::begin(gl::Quads); - } - - math::Color color(entity->color()); - color.a = 1.0f; - gl::color(color); - glTexCoord2f(0.0f, 0.0f); - gl::vertex(l.x() - r, l.y() - r); - - glTexCoord2f(1.0f, 0.0f); - gl::vertex(l.x() + r, l.y() - r); - - glTexCoord2f(1.0f, 1.0f); - gl::vertex(l.x() + r, l.y() + r); - - glTexCoord2f(0.0f, 1.0f); - gl::vertex(l.x() - r, l.y() + r); - } - //} - - gl::end(); - gl::disable(GL_TEXTURE_2D); - - if (mapwindow_target != current_target ) { - // this makes sure the map target exists - set_target(current_target); - - } else if (mapwindow_inforecord && (mapwindow_infotimestamp != mapwindow_inforecord->timestamp())) { - set_target(mapwindow_target); - } - */ } void MapWindow::set_target(const core::Entity *entity) { @@ -385,7 +218,7 @@ bool MapWindow::on_keypress(const int key, const unsigned int modifier) return false; } -bool MapWindow::on_emit(Widget *sender, const Event event, void *data) +bool MapWindow::on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data) { if (sender == mapwindow_closebutton) { if (event == ui::Widget::EventButtonClicked) { -- cgit v1.2.3