X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphic.h;h=1ae0d5e22d8766a718bbd828329be7bb334663dd;hb=c8291177b545ec81930603a5915234a60296db51;hp=81ad669c717f0a66d1a977825f33212254edbaf1;hpb=2b70e8801c43875ed3f4135bdd0141265cff0312;p=libs%2Fgltk.git diff --git a/source/graphic.h b/source/graphic.h index 81ad669..1ae0d5e 100644 --- a/source/graphic.h +++ b/source/graphic.h @@ -1,8 +1,9 @@ #ifndef MSP_GLTK_GRAPHIC_H_ #define MSP_GLTK_GRAPHIC_H_ +#include #include -#include +#include #include "geometry.h" namespace Msp { @@ -16,17 +17,11 @@ Stores a single graphical element. Graphics are used as parts of widgets. class 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); @@ -48,7 +43,7 @@ public: 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;