X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphic.h;h=1647d2f811f49704ca3ce9795fdedaef637ebcb9;hb=3f301f9b6f73e886bdbb61565edb2c02667039d0;hp=a9722ad97ff3e498187fffae3ff229a4654e66ae;hpb=d7ae291415a21cc886fe318070b41ac8d3e57a30;p=libs%2Fgltk.git diff --git a/source/graphic.h b/source/graphic.h index a9722ad..1647d2f 100644 --- a/source/graphic.h +++ b/source/graphic.h @@ -1,3 +1,10 @@ +/* $Id$ + +This file is part of libmspgltk +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #ifndef MSP_GLTK_GRAPHIC_H_ #define MSP_GLTK_GRAPHIC_H_ @@ -10,6 +17,9 @@ namespace GLtk { class Resources; +/** +Stores a single graphical element. Graphics are used as parts of widgets. +*/ class Graphic { public: @@ -23,6 +33,7 @@ public: typedef Resources Collection; Loader(Graphic &, Resources &); + Graphic &get_object() const { return graph; } private: void texture(const std::string &); void slice(unsigned, unsigned, unsigned, unsigned); @@ -30,6 +41,14 @@ public: void shadow(); }; +private: + Sides border; + Sides shadow; + const GL::Texture2D *texture; + Geometry slice; + bool repeat; + +public: Graphic(); const Sides &get_border() const { return border; } const Sides &get_shadow() const { return shadow; } @@ -38,10 +57,8 @@ public: unsigned get_height() const { return slice.h; } void render(unsigned, unsigned) const; private: - Sides border; - Sides shadow; - const GL::Texture2D *texture; - Geometry slice; + void create_coords(float, float, float, float, float, std::vector &) const; + void create_texcoords(float, float, float, float, float, std::vector &) const; }; } // namespace GLtk