]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/style.cpp
Adjust things to conform to changes in other libraries
[libs/gltk.git] / source / style.cpp
index d53ae240fcea168a1b4659e6d8ac4472ec79f69c..eff93fe3c354255b9f53048b54d2022a472f68b1 100644 (file)
@@ -8,7 +8,8 @@ namespace GLtk {
 
 Style::Style():
        font(0),
-       font_size(0)
+       font_size(0),
+       sampler(0)
 { }
 
 const GL::Font &Style::get_font() const
@@ -26,6 +27,13 @@ const GL::Color &Style::get_font_color(State s) const
        return font_color[s];
 }
 
+const GL::Sampler &Style::get_sampler() const
+{
+       if(!sampler)
+               throw logic_error("!sampler");
+       return *sampler;
+}
+
 const Part *Style::get_part(const string &name) const
 {
        for(PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
@@ -61,6 +69,8 @@ Style::Loader::Loader(Style &s, Resources &r):
                obj.font = &get_collection().get_default_font();
                obj.font_size = obj.font->get_native_size();
        }
+       if(!obj.sampler)
+               obj.sampler = &get_collection().get<GL::Sampler>("linear_clamp.samp");
 
        add("font",       &Loader::font);
        add("font_color", &Loader::font_color_normal);
@@ -68,6 +78,7 @@ Style::Loader::Loader(Style &s, Resources &r):
        add("font_size",  &Style::font_size);
        add("part",       &Loader::part);
        add("part",       &Loader::unnamed_part);
+       add("sampler",    &Style::sampler);
 }
 
 void Style::Loader::font(const string &n)