#define MSP_GLTK_GRAPHIC_H_
#include <msp/gl/texture2d.h>
-#include <msp/parser/loader.h>
+#include <msp/datafile/loader.h>
#include "geometry.h"
namespace Msp {
class Graphic
{
public:
- class Loader: public Parser::Loader
+ class Loader: public DataFile::Loader
{
- public:
- Loader(Graphic &);
private:
Graphic &graph;
+ Resources &res;
+
+ public:
+ typedef Resources Collection;
+ Loader(Graphic &, Resources &);
+ private:
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 &);
+ 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_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;