X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fresources.h;h=cf8116dbc7392f1eb9a60d51df959c081040db48;hb=d7ae291415a21cc886fe318070b41ac8d3e57a30;hp=40e44220a5b7de1b53011a14cb16d2ebe67ee6ee;hpb=131ac8ff2c06f94d40f4bf98d4a6ec0d113cdffc;p=libs%2Fgltk.git diff --git a/source/resources.h b/source/resources.h index 40e4422..cf8116d 100644 --- a/source/resources.h +++ b/source/resources.h @@ -3,60 +3,39 @@ #include #include -#include +#include +#include #include "graphic.h" #include "style.h" namespace Msp { namespace GLtk { -class Resources +class Resources: public DataFile::Collection { -public: +private: + Path path; + GL::Font *default_font; - class Loader: public Msp::DataFile::Loader +public: + class Loader: public Collection::Loader { - public: - Loader(Resources &); private: Resources &res; + public: + Loader(Resources &); + private: void font(const std::string &); - void texture(const std::string &); - void graphic(const std::string &); - void style(const std::string &, const std::string &); }; Resources(); - ~Resources(); - const GL::Font &get_font(const std::string &) const; + + void set_path(const Path &); const GL::Font &get_default_font() const; - const GL::Texture2D &get_texture(const std::string &) const; - const Graphic &get_graphic(const std::string &) const; - const Style &get_style(const std::string &, const std::string &) const; private: - struct StyleId - { - std::string widget; - std::string name; - - StyleId(const std::string &w, const std::string &n): widget(w), name(n) { } - bool operator<(const StyleId &) const; - }; - - typedef std::map FontMap; - typedef std::map TextureMap; - typedef std::map GraphicMap; - typedef std::map StyleMap; - - FontMap fonts; - GL::Font *default_font; - TextureMap textures; - GraphicMap graphics; - StyleMap styles; - - Resources(const Resources &); - Resources &operator=(const Resources &); + GL::Font *create_font(const std::string &); + GL::Texture2D *create_texture(const std::string &); }; } // namespace GLtk