Resources::Resources()
{
- init();
+ add_type<Graphic>().keyword("graphic");
+ add_type<GL::Module>().creator([this](const string &n){ return create_module(n); });
+ add_type<GL::Sampler>().creator([this](const string &n){ return create_sampler(n); });
+ add_type<GL::Program>().creator([this](const string &n){ return create_program(n); });
+ add_type<GL::Texture2D>().keyword("texture").creator([this](const string &n){ return create_texture(n); });
+ add_type<GL::Font>().keyword("font");
+ add_type<Style>().keyword("style");
}
-Resources::Resources(const FS::Path &fn)
+Resources::Resources(const FS::Path &fn):
+ Resources()
{
- init();
-
dir_src = new DataFile::DirectorySource;
dir_src->add_directory(FS::dirname(fn));
add_source(*dir_src);
DataFile::load(*this, fn.str());
}
-void Resources::init()
-{
- default_font = 0;
- dir_src = 0;
- add_type<Graphic>().keyword("graphic");
- add_type<GL::Module>().creator([this](const string &n){ return create_module(n); });
- add_type<GL::Sampler>().creator([this](const string &n){ return create_sampler(n); });
- add_type<GL::Program>().creator([this](const string &n){ return create_program(n); });
- add_type<GL::Texture2D>().keyword("texture").creator([this](const string &n){ return create_texture(n); });
- add_type<GL::Font>().keyword("font");
- add_type<Style>().keyword("style");
-}
-
Resources::~Resources()
{
delete dir_src;