3 This file is part of libmspgltk
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GLTK_GRAPHIC_H_
9 #define MSP_GLTK_GRAPHIC_H_
11 #include <msp/gl/texture2d.h>
12 #include <msp/datafile/loader.h>
21 Stores a single graphical element. Graphics are used as parts of widgets.
26 class Loader: public DataFile::Loader
33 typedef Resources Collection;
35 Loader(Graphic &, Resources &);
36 Graphic &get_object() const { return graph; }
38 void texture(const std::string &);
39 void slice(unsigned, unsigned, unsigned, unsigned);
47 const GL::Texture2D *texture;
53 const Sides &get_border() const { return border; }
54 const Sides &get_shadow() const { return shadow; }
55 const GL::Texture2D *get_texture() const { return texture; }
56 unsigned get_width() const { return slice.w; }
57 unsigned get_height() const { return slice.h; }
58 void render(unsigned, unsigned) const;
60 void create_coords(float, float, float, float, float, std::vector<float> &) const;
61 void create_texcoords(float, float, float, float, float, std::vector<float> &) const;