diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Makefile.am | 4 | ||||
-rw-r--r-- | src/render/primitives.cc | 19 | ||||
-rw-r--r-- | src/render/primitives.h | 96 |
3 files changed, 2 insertions, 117 deletions
diff --git a/src/render/Makefile.am b/src/render/Makefile.am index dd2f5f8..27ad8bb 100644 --- a/src/render/Makefile.am +++ b/src/render/Makefile.am @@ -10,6 +10,6 @@ endif librender_la_LDFLAGS = -avoid-version -no-undefined @GL_LIBS@ librender_la_LIBADD = $(top_builddir)/src/math/libmath.la librender_la_SOURCES = camera.cc draw.cc dust.cc gl.cc image.cc jpgfile.cc \ - pngfile.cc primitives.cc render.cc text.cc textures.cc tga.cc + pngfile.cc render.cc text.cc textures.cc tga.cc noinst_HEADERS = camera.h draw.h dust.h gl.h image.h render.h text.h textures.h \ - tga.h pngfile.h jpgfile.h primitives.h + tga.h pngfile.h jpgfile.h diff --git a/src/render/primitives.cc b/src/render/primitives.cc deleted file mode 100644 index b790c70..0000000 --- a/src/render/primitives.cc +++ /dev/null @@ -1,19 +0,0 @@ -/* - render/primitives.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 -*/ - - -#include "render/primitives.h" - -namespace render -{ - -namespace primitives -{ - -} - -} - diff --git a/src/render/primitives.h b/src/render/primitives.h deleted file mode 100644 index 679a76e..0000000 --- a/src/render/primitives.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - render/primitives.h - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 -*/ - -#ifndef __INCLUDED_RENDER_PRIMITIVES_H__ -#define __INCLUDED_RENDER_PRIMITIVES_H__ - -#include "auxiliary/functions.h" -#include "math/vector2f.h" -#include "render/gl.h" -#include "render/text.h" -#include "render/textures.h" - -namespace render -{ - -/// drawing primitives for the user interface -namespace primitives -{ - -/// draw a border -inline void border(math::Vector2f const &location, math::Vector2f const &size) -{ - using namespace render::gl; - - begin(LineLoop); - vertex(location.x +1 , location.y); - vertex(location.x + size.x, location.y); - vertex(location.x + size.x, location.y + size.y -1); - vertex(location.x +1, location.y + size.y - 1); - end(); -} - -/// draw a rectangle -inline void rectangle(math::Vector2f const &location, math::Vector2f const &size) -{ - using namespace render::gl; - - begin(Quads); - vertex(location.x +1 , location.y); - vertex(location.x + size.x, location.y); - vertex(location.x + size.x, location.y + size.y -1); - vertex(location.x +1, location.y + size.y - 1); - end(); -} - -/// draw a rectangular bitmap -inline void bitmap(math::Vector2f const &location, math::Vector2f const &size, std::string const &texture) -{ - - using namespace render::gl; - - render::Textures::bind("bitmaps/" + texture); - gl::enable(GL_TEXTURE_2D); - - begin(Quads); - - glTexCoord2f(0.0f, 0.0f); - vertex(location.x +1 , location.y); - - glTexCoord2f(1.0f, 0.0f); - vertex(location.x + size.x, location.y); - - glTexCoord2f(1.0f, 1.0f); - 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::disable(GL_TEXTURE_2D); -} - -/// draw one line of centered text -inline void text_centered(math::Vector2f const &location, math::Vector2f const &size, std::string const &text) -{ - Text::setfont("gui", 14, 24); - gl::enable(GL_TEXTURE_2D); - - math::Vector2f v(location); - - v.x += (size.x - aux::text_strip(text).size() * Text::fontwidth()) /2.0f; - v.y += (size.y - Text::fontheight()) / 2.0f; - - Text::draw(v.x, v.y, text); - - gl::disable(GL_TEXTURE_2D); -} - -} - -} - -#endif // __INCLUDED_RENDER_PRIMITIVES_H__ |