]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/graphic.h
Support loading Buttons from datafiles
[libs/gltk.git] / source / graphic.h
index 912786ce380f195fd173460d3406ed8087eec4ee..b93111348175874150190c1666c5d6896d6efe61 100644 (file)
@@ -15,18 +15,23 @@ 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 &);
+       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 +39,14 @@ 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;
+       bool repeat;
+
+       void create_coords(float, float, float, float, float, std::vector<float> &) const;
+       void create_texcoords(float, float, float, float, float, std::vector<float> &) const;
 };
 
 } // namespace GLtk