X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphic.h;h=81ad669c717f0a66d1a977825f33212254edbaf1;hb=c8f5fd14a1fbdaaa9e1216dd5163d1f5c1b5ff27;hp=912786ce380f195fd173460d3406ed8087eec4ee;hpb=131ac8ff2c06f94d40f4bf98d4a6ec0d113cdffc;p=libs%2Fgltk.git diff --git a/source/graphic.h b/source/graphic.h index 912786c..81ad669 100644 --- a/source/graphic.h +++ b/source/graphic.h @@ -10,23 +10,39 @@ namespace GLtk { class Resources; +/** +Stores a single graphical element. Graphics are used as parts of widgets. +*/ class Graphic { public: class Loader: public DataFile::Loader { - public: - Loader(Graphic &); 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); void border(); void shadow(); }; - Graphic(const Resources &, const std::string &); +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; } @@ -34,12 +50,8 @@ public: unsigned get_height() const { return slice.h; } void render(unsigned, unsigned) const; private: - const Resources &res; - std::string name; - 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