X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphic.h;h=b114d7e1c96eba41fd555453d71cb6d1b5dd4cc4;hb=9f38197854e699a6093a906ab43f4238f3cd2388;hp=81ad669c717f0a66d1a977825f33212254edbaf1;hpb=2b70e8801c43875ed3f4135bdd0141265cff0312;p=libs%2Fgltk.git diff --git a/source/graphic.h b/source/graphic.h index 81ad669..b114d7e 100644 --- a/source/graphic.h +++ b/source/graphic.h @@ -1,9 +1,11 @@ #ifndef MSP_GLTK_GRAPHIC_H_ #define MSP_GLTK_GRAPHIC_H_ +#include #include -#include +#include #include "geometry.h" +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -13,20 +15,14 @@ class Resources; /** Stores a single graphical element. Graphics are used as parts of widgets. */ -class Graphic +class MSPGLTK_API Graphic { public: - class Loader: public DataFile::Loader + class Loader: public DataFile::CollectionObjectLoader { - private: - Graphic &graph; - Resources &res; - 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); @@ -37,18 +33,17 @@ public: private: Sides border; Sides shadow; - const GL::Texture2D *texture; + const GL::Texture2D *texture = 0; Geometry slice; - bool repeat; + bool repeat = false; 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: void create_coords(float, float, float, float, float, std::vector &) const; void create_texcoords(float, float, float, float, float, std::vector &) const;