From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/client/map.cc | 81 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'src/client/map.cc') diff --git a/src/client/map.cc b/src/client/map.cc index aca5e97..7a6fedc 100644 --- a/src/client/map.cc +++ b/src/client/map.cc @@ -1,8 +1,8 @@ /* client/map.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 */ #include "audio/audio.h" @@ -16,7 +16,8 @@ #include "render/textures.h" #include "render/text.h" -namespace client { +namespace client +{ Map::Map(ui::Widget *parent) : ui::Window(parent) { @@ -72,7 +73,7 @@ void Map::draw() const float margin = font()->width() * 2.0f; const float s = ui::UI::elementsize.width() * 2.0f; const float blue = 0.8f; - const float gridsize=16; + const float gridsize = 16; core::Entity *entity; const core::Entity *current_target = map_target; @@ -87,10 +88,10 @@ void Map::draw() v[1] += (height() - s - 2.0f * margin) * 0.5f; map_hover = 0; - gl::color(0,0,blue); + gl::color(0, 0, blue); gl::begin(gl::Lines); - for (int i=0; i <= gridsize; i++) { + 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); @@ -102,7 +103,7 @@ void Map::draw() 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; @@ -140,7 +141,7 @@ void Map::draw() if (core::application()->time() - floorf(core::application()->time()) < 0.5f) { draw_icon = false; } - } + } } if (draw_icon) { @@ -165,7 +166,7 @@ void Map::draw() gl::begin(gl::Quads); } } - + if (entity == core::localplayer()->mission_target()) { color.assign(palette()->mission()); } else { @@ -176,55 +177,55 @@ void Map::draw() 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); + 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 (map_target) { - map_targetlabel->set_size(width() - s - margin * 3.0f, map_targetlabel->font()->height() * 2.0f ); + map_targetlabel->set_size(width() - s - margin * 3.0f, map_targetlabel->font()->height() * 2.0f); map_targetlabel->set_location(s + margin * 2.0f, 4); map_targetlabel->set_text(map_target->name()); map_targetlabel->show(); @@ -234,7 +235,7 @@ void Map::draw() } bool Map::on_keypress(const int key, const unsigned int modifier) -{ +{ if (key == 512 + SDL_BUTTON_LEFT) { if (hover()) { core::Entity *target = core::localplayer()->zone()->find_entity(hover()); -- cgit v1.2.3