diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-11 19:11:57 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-11 19:11:57 +0000 |
commit | 773c1bafe0f1d8b706e0f72e235f8466e7a9ccf5 (patch) | |
tree | ab4b3058f436a4e4c54618f132a9179ee40e330c /src/ui | |
parent | 3082cb197fb6af7d069f9ad211ff6ea5657d924a (diff) |
cleanups
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.cc | 2 | ||||
-rw-r--r-- | src/ui/paint.cc | 42 | ||||
-rw-r--r-- | src/ui/scrollpane.cc | 6 | ||||
-rw-r--r-- | src/ui/ui.cc | 10 |
4 files changed, 28 insertions, 32 deletions
diff --git a/src/ui/console.cc b/src/ui/console.cc index 0b7c278..60eecef 100644 --- a/src/ui/console.cc +++ b/src/ui/console.cc @@ -192,7 +192,7 @@ void Console::draw() version += ' '; version.append(core::version()); - render::gl::color(0.0f, 1.0f, 0.0f, 0.5f); + gl::color(0.0f, 1.0f, 0.0f, 0.5f); s.assign(version.size() * font()->width(), font()->height()); math::Vector2f l(global_location()); diff --git a/src/ui/paint.cc b/src/ui/paint.cc index 45b7eea..86058cf 100644 --- a/src/ui/paint.cc +++ b/src/ui/paint.cc @@ -19,12 +19,12 @@ namespace paint { void color(float r, float g, float b, float a) { - render::gl::color(r, g, b, a); + gl::color(r, g, b, a); } void color(math::Color const & color) { - render::gl::color(color); + gl::color(color); } void color_code(const char c) @@ -34,7 +34,7 @@ void color_code(const char c) void border(const math::Vector2f &location, const math::Vector2f &size) { - using namespace render::gl; + using namespace gl; begin(LineLoop); vertex(location.x +1 , location.y); @@ -46,7 +46,7 @@ void border(const math::Vector2f &location, const math::Vector2f &size) void rectangle(const math::Vector2f &location, const math::Vector2f &size) { - using namespace render::gl; + using namespace gl; begin(Quads); vertex(location.x +1 , location.y); @@ -59,27 +59,25 @@ void rectangle(const math::Vector2f &location, const math::Vector2f &size) // draw a bitmap void bitmap(const math::Vector2f &location, const math::Vector2f &size, std::string const &texture) { - using namespace render::gl; - render::Textures::bind("bitmaps/" + texture); - enable(GL_TEXTURE_2D); + gl::enable(GL_TEXTURE_2D); - begin(Quads); + gl::begin(gl::Quads); glTexCoord2f(0.0f, 0.0f); - vertex(location.x +1 , location.y); + gl::vertex(location.x +1 , location.y); glTexCoord2f(1.0f, 0.0f); - vertex(location.x + size.x, location.y); + gl::vertex(location.x + size.x, location.y); glTexCoord2f(1.0f, 1.0f); - vertex(location.x + size.x, location.y + size.y -1); + gl::vertex(location.x + size.x, location.y + size.y -1); glTexCoord2f(0.0f, 1.0f); - vertex(location.x +1, location.y + size.y - 1); - end(); + gl::vertex(location.x +1, location.y + size.y - 1); + gl::end(); - disable(GL_TEXTURE_2D); + gl::disable(GL_TEXTURE_2D); } // draw aligned text @@ -94,11 +92,10 @@ void label(const math::Vector2f &location, const math::Vector2f &size, const Fon align_vertical = AlignTop; // apply text font - using namespace render::gl; render::Text::setfont(font->name().c_str(), font->width(), font->height()); // enable OpenGL textures - enable(GL_TEXTURE_2D); + gl::enable(GL_TEXTURE_2D); // determine the width and height of the text // FIXME support multiline text @@ -135,38 +132,37 @@ void label(const math::Vector2f &location, const math::Vector2f &size, const Fon render::Text::draw(v.x, v.y, text); // disable OpenGL textures - disable(GL_TEXTURE_2D); + gl::disable(GL_TEXTURE_2D); } // draw unaligned text void text(const math::Vector2f &location, const math::Vector2f &size, const Font *font, const std::string &text) { - using namespace render::gl; render::Text::setfont(font->name().c_str(), font->width(), font->height()); // enable OpenGL textures - enable(GL_TEXTURE_2D); + gl::enable(GL_TEXTURE_2D); render::Text::draw(location.x, location.y, text); // disable OpenGL textures - disable(GL_TEXTURE_2D); + gl::disable(GL_TEXTURE_2D); } // draw unaligned text void text(const math::Vector2f &location, const math::Vector2f &size, const Font *font, std::stringstream & textstream) { - using namespace render::gl; + render::Text::setfont(font->name().c_str(), font->width(), font->height()); // enable OpenGL textures - enable(GL_TEXTURE_2D); + gl::enable(GL_TEXTURE_2D); render::Text::draw(location.x, location.y, textstream); // disable OpenGL textures - disable(GL_TEXTURE_2D); + gl::disable(GL_TEXTURE_2D); } } diff --git a/src/ui/scrollpane.cc b/src/ui/scrollpane.cc index a1de7d5..b4d08d6 100644 --- a/src/ui/scrollpane.cc +++ b/src/ui/scrollpane.cc @@ -57,7 +57,7 @@ void ScrollPane::dec_scroll(int scroll) void ScrollPane::draw() { render::Text::setfont(font()->name().c_str(), font()->width(), font()->height()); - render::gl::enable(GL_TEXTURE_2D); + gl::enable(GL_TEXTURE_2D); // text size int text_height = (int) floorf(height() / font()->height()); @@ -161,7 +161,7 @@ void ScrollPane::draw() current_line++; } - render::gl::color(palette()->text()); + gl::color(palette()->text()); const math ::Vector2f gl(global_location()); float y = 0; @@ -181,7 +181,7 @@ void ScrollPane::draw() y -= font()->height(); } } - render::gl::disable(GL_TEXTURE_2D); + gl::disable(GL_TEXTURE_2D); } } diff --git a/src/ui/ui.cc b/src/ui/ui.cc index 7d57ce0..bc6f544 100644 --- a/src/ui/ui.cc +++ b/src/ui/ui.cc @@ -597,19 +597,19 @@ void UI::draw_pointer() texture.append(mouse_pointer_bitmap); if (mouse_pointer_animated) { - render::gl::push(); - render::gl::translate(mouse_cursor.x, mouse_cursor.y, 0); + gl::push(); + gl::translate(mouse_cursor.x, mouse_cursor.y, 0); float angle = core::application()->time()* 0.75f - floorf(core::application()->time() * 0.75f); angle *= 360.0f; - render::gl::rotate(angle, math::Vector3f(0, 0, 1.0f)); - render::gl::translate(-mouse_cursor.x, -mouse_cursor.y, 0); + gl::rotate(angle, math::Vector3f(0, 0, 1.0f)); + gl::translate(-mouse_cursor.x, -mouse_cursor.y, 0); } paint::bitmap(pos, s, texture); if (mouse_pointer_animated) { - render::gl::pop(); + gl::pop(); } } |