X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphic.h;fp=source%2Fgraphic.h;h=16d8cf406a006096e95fc31778136e6996384d2a;hb=c1f038acb91eb3bfaa34dfd4729d19ed3f871a42;hp=0000000000000000000000000000000000000000;hpb=1b5097c11b1226e14e23a0827c5238ba5d3ba444;p=libs%2Fgltk.git diff --git a/source/graphic.h b/source/graphic.h new file mode 100644 index 0000000..16d8cf4 --- /dev/null +++ b/source/graphic.h @@ -0,0 +1,67 @@ +#ifndef MSP_GLTK_GRAPHIC_H_ +#define MSP_GLTK_GRAPHIC_H_ + +#include +#include +#include "geometry.h" + +namespace Msp { +namespace GLtk { + +class Resources; + +class Graphic +{ +public: + class Loader: public Parser::Loader + { + public: + Loader(Graphic &); + private: + Graphic &graph; + + void texture(const std::string &); + void slice(unsigned, unsigned, unsigned, unsigned); + void border(); + void shadow(); + }; + + struct Sides + { + class Loader: public Parser::Loader + { + public: + Loader(Sides &); + Sides &get_object() { return sides; } + private: + Sides &sides; + }; + + unsigned top; + unsigned right; + unsigned bottom; + unsigned left; + + Sides(); + }; + + Graphic(const Resources &, const std::string &); + 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; +private: + const Resources &res; + std::string name; + Sides border; + Sides shadow; + const GL::Texture2D *texture; + Geometry slice; +}; + +} // namespace GLtk +} // namespace Msp + +#endif