X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fstyle.cpp;h=da772dc8d21051148ff1aa22f372e3a6590812cc;hb=358f45ef39381b4eb4f37dc6c20e52fd07c0fbcf;hp=001b36937e03f4ab03261043d3414ae9ce49060e;hpb=3d84860cb25cf05ed36ee6cbd07d9e58cee52422;p=libs%2Fgltk.git diff --git a/source/style.cpp b/source/style.cpp index 001b369..da772dc 100644 --- a/source/style.cpp +++ b/source/style.cpp @@ -29,26 +29,32 @@ const Part *Style::get_part(const string &name) const Style::Loader::Loader(Style &s, Resources &r): - style(s), - res(r) + DataFile::CollectionObjectLoader(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", &Style::font); + add("font", &Loader::font); add("font_color", &Loader::font_color); + add("font_size", &Style::font_size); add("part", static_cast(&Loader::part)); add("part", static_cast(&Loader::part)); // Deprecated alias add("special", static_cast(&Loader::part)); } +void Style::Loader::font(const string &n) +{ + obj.font = &get_collection().get(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() @@ -59,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