X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fresources.cpp;h=825fc2517875771874c564989ea9da04c27e144f;hb=ae991f3bbd83fa0afff5e1fc31be50e1f2d17875;hp=7415beb5473312e57fcabb29d6691114aa733fc1;hpb=0af3c2393bd00f39db3bfaf5b78a7a44f0fd5ff1;p=libs%2Fgltk.git diff --git a/source/resources.cpp b/source/resources.cpp index 7415beb..825fc25 100644 --- a/source/resources.cpp +++ b/source/resources.cpp @@ -6,6 +6,7 @@ Distributed under the LGPL */ #include +#include #include "resources.h" using namespace std; @@ -16,6 +17,20 @@ namespace GLtk { Resources::Resources(): path("."), default_font(0) +{ + init(); +} + +Resources::Resources(const FS::Path &fn): + path(FS::dirname(fn)), + default_font(0) +{ + init(); + + DataFile::load(*this, fn.str()); +} + +void Resources::init() { add_keyword("graphic"); add_keyword("texture"); @@ -26,6 +41,8 @@ Resources::Resources(): void Resources::set_path(const FS::Path &p) { + /* XXX bad, should change Collection API to allow creators to form paths + relative to the datafile location */ path = p; }