]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/resources.cpp
Adapt to DataFile changes
[libs/gltk.git] / source / resources.cpp
index 650140ba4552f59b066f00cc5677b5d34dfd9734..3b0f4f9154648b88d7254cb6f575854de341193b 100644 (file)
@@ -34,14 +34,16 @@ const GL::Font &Resources::get_default_font() const
 GL::Font *Resources::create_font(const string &name)
 {
        RefPtr<GL::Font> fnt=new GL::Font;
-       DataFile::load(*fnt, (path/(name+".font")).str());
+       DataFile::load<GL::Font, Resources &>(*fnt, (path/(name+".font")).str(), *this);
+       if(!default_font)
+               default_font=fnt.get();
        return fnt.release();
 }
 
 GL::Texture2D *Resources::create_texture(const string &name)
 {
        RefPtr<GL::Texture2D> tex=new GL::Texture2D;
-       tex->image((path/(name+".png")).str());
+       tex->load_image((path/(name+".png")).str());
        tex->set_min_filter(GL::LINEAR);
        return tex.release();
 }
@@ -51,9 +53,15 @@ Resources::Loader::Loader(Resources &r):
        Collection::Loader(r),
        res(r)
 {
+       add("default_font", &Loader::default_font);
        add("font", &Loader::font);
 }
 
+void Resources::Loader::default_font(const string &name)
+{
+       res.default_font=res.get<GL::Font>(name);
+}
+
 void Resources::Loader::font(const string &name)
 {
        RefPtr<GL::Font> fnt=new GL::Font;