X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphic.h;h=f457d3690b297a91d989dc92ed9ce5fa634268d4;hb=8fc5cb226f0c2b36298f51b3d2501b04ebb11b8a;hp=a9722ad97ff3e498187fffae3ff229a4654e66ae;hpb=d7ae291415a21cc886fe318070b41ac8d3e57a30;p=libs%2Fgltk.git diff --git a/source/graphic.h b/source/graphic.h index a9722ad..f457d36 100644 --- a/source/graphic.h +++ b/source/graphic.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_GRAPHIC_H_ #define MSP_GLTK_GRAPHIC_H_ +#include #include #include #include "geometry.h" @@ -10,6 +11,9 @@ namespace GLtk { class Resources; +/** +Stores a single graphical element. Graphics are used as parts of widgets. +*/ class Graphic { public: @@ -23,6 +27,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,18 +35,24 @@ 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; } const GL::Texture2D *get_texture() const { return texture; } unsigned get_width() const { return slice.w; } unsigned get_height() const { return slice.h; } - void render(unsigned, unsigned) const; + void build(unsigned, unsigned, GL::PrimitiveBuilder &) 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