]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/resources.cpp
Update layout when panel's geometry changes
[libs/gltk.git] / source / resources.cpp
index 825fc2517875771874c564989ea9da04c27e144f..e83c1bb178e5adea2acc6525acfdc01c0b8b87f1 100644 (file)
@@ -1,11 +1,3 @@
-/* $Id$
-
-This file is part of libmspgltk
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include <msp/core/except.h>
 #include <msp/fs/utils.h>
 #include "resources.h"
 
@@ -32,11 +24,9 @@ Resources::Resources(const FS::Path &fn):
 
 void Resources::init()
 {
-       add_keyword<Graphic>("graphic");
-       add_keyword<GL::Texture2D>("texture");
-
-       add_creator(&Resources::create_font);
-       add_creator(&Resources::create_texture);
+       add_type<Graphic>().keyword("graphic");
+       add_type<GL::Texture2D>().keyword("texture").creator(&Resources::create_texture);
+       add_type<GL::Font>().creator(&Resources::create_font);
 }
 
 void Resources::set_path(const FS::Path &p)
@@ -49,7 +39,7 @@ void Resources::set_path(const FS::Path &p)
 const GL::Font &Resources::get_default_font() const
 {
        if(!default_font)
-               throw InvalidState("No default font");
+               throw logic_error("!default_font");
 
        return *default_font;
 }
@@ -83,7 +73,7 @@ Resources::Loader::Loader(Resources &r):
 
 void Resources::Loader::default_font(const string &name)
 {
-       res.default_font = res.get<GL::Font>(name);
+       res.default_font = &res.get<GL::Font>(name);
 }
 
 void Resources::Loader::font(const string &name)