From 773c1bafe0f1d8b706e0f72e235f8466e7a9ccf5 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 11 Nov 2008 19:11:57 +0000 Subject: cleanups --- src/ui/paint.cc | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'src/ui/paint.cc') 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); } } -- cgit v1.2.3