X-Git-Url: http://git.tdb.fi/?p=libs%2Fgltk.git;a=blobdiff_plain;f=source%2Fstyle.cpp;h=eff93fe3c354255b9f53048b54d2022a472f68b1;hp=d53ae240fcea168a1b4659e6d8ac4472ec79f69c;hb=6deafc9f236b90175a303944815f7c0eac1c95c1;hpb=999cd0294889e5eecd61df18a697d2c55ed6c0d6 diff --git a/source/style.cpp b/source/style.cpp index d53ae24..eff93fe 100644 --- a/source/style.cpp +++ b/source/style.cpp @@ -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("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)