15 const GL::Font &Style::get_font() const
18 throw logic_error("!font");
22 const GL::Color &Style::get_font_color(State s) const
25 throw invalid_argument("Style::get_font_color");
30 const GL::Sampler &Style::get_sampler() const
33 throw logic_error("!sampler");
37 const Part *Style::get_part(const string &name) const
39 for(PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
40 if(i->get_name()==name)
46 bool Style::compare_states(State s1, State s2) const
48 if(s1>=N_STATES_ || s2>=N_STATES_)
49 throw invalid_argument("Style::compare_states");
51 const GL::Color &c1 = font_color[s1];
52 const GL::Color &c2 = font_color[s2];
53 if(c1.r!=c2.r || c1.g!=c2.g || c1.b!=c2.b)
56 for(PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
57 if(i->get_graphic(s1)!=i->get_graphic(s2))
64 Style::Loader::Loader(Style &s, Resources &r):
65 DataFile::CollectionObjectLoader<Style, Resources>(s, &r)
69 obj.font = &get_collection().get_default_font();
70 obj.font_size = obj.font->get_native_size();
73 obj.sampler = &get_collection().get<GL::Sampler>("linear_clamp.samp");
75 add("font", &Loader::font);
76 add("font_color", &Loader::font_color_normal);
77 add("font_color", &Loader::font_color);
78 add("font_size", &Style::font_size);
79 add("part", &Loader::part);
80 add("part", &Loader::unnamed_part);
81 add("sampler", &Style::sampler);
84 void Style::Loader::font(const string &n)
86 obj.font = &get_collection().get<GL::Font>(n);
87 obj.font_size = obj.font->get_native_size();
90 void Style::Loader::font_color_normal(float r, float g, float b)
92 font_color(NORMAL, r, g, b);
95 void Style::Loader::font_color(State s, float r, float g, float b)
97 for(unsigned i=0; i<N_STATES_; ++i)
99 obj.font_color[i] = GL::Color(r, g, b);
102 void Style::Loader::part(const string &n)
105 load_sub(p, get_collection());
106 obj.parts.push_back(p);
109 void Style::Loader::unnamed_part()