]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/style.cpp
Update loaders to use ObjectLoader as base class
[libs/gltk.git] / source / style.cpp
index 44ad4144931daf223fb96e8bca478a35a4b8063a..da772dc8d21051148ff1aa22f372e3a6590812cc 100644 (file)
@@ -29,13 +29,12 @@ const Part *Style::get_part(const string &name) const
 
 
 Style::Loader::Loader(Style &s, Resources &r):
-       style(s),
-       res(r)
+       DataFile::CollectionObjectLoader<Style, Resources>(s, &r)
 {
-       if(!style.font)
+       if(!obj.font)
        {
-               style.font = &r.get_default_font();
-               style.font_size = style.font->get_native_size();
+               obj.font = &get_collection().get_default_font();
+               obj.font_size = obj.font->get_native_size();
        }
 
        add("font",       &Loader::font);
@@ -49,13 +48,13 @@ Style::Loader::Loader(Style &s, Resources &r):
 
 void Style::Loader::font(const string &n)
 {
-       style.font = &res.get<GL::Font>(n);
-       style.font_size = style.font->get_native_size();
+       obj.font = &get_collection().get<GL::Font>(n);
+       obj.font_size = obj.font->get_native_size();
 }
 
 void Style::Loader::font_color(float r, float g, float b)
 {
-       style.font_color = GL::Color(r, g, b);
+       obj.font_color = GL::Color(r, g, b);
 }
 
 void Style::Loader::part()
@@ -66,8 +65,8 @@ void Style::Loader::part()
 void Style::Loader::part(const string &n)
 {
        Part p(n);
-       load_sub(p, res);
-       style.parts.push_back(p);
+       load_sub(p, get_collection());
+       obj.parts.push_back(p);
 }
 
 } // namespace GLtk