14 const GL::Font &Style::get_font() const
17 throw logic_error("!font");
21 const GL::Color &Style::get_font_color(State s) const
24 throw invalid_argument("Style::get_font_color");
29 const Part *Style::get_part(const string &name) const
31 for(PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
32 if(i->get_name()==name)
38 bool Style::compare_states(State s1, State s2) const
40 if(s1>=N_STATES_ || s2>=N_STATES_)
41 throw invalid_argument("Style::compare_states");
43 const GL::Color &c1 = font_color[s1];
44 const GL::Color &c2 = font_color[s2];
45 if(c1.r!=c2.r || c1.g!=c2.g || c1.b!=c2.b)
48 for(PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
49 if(i->get_graphic(s1)!=i->get_graphic(s2))
56 Style::Loader::Loader(Style &s, Resources &r):
57 DataFile::CollectionObjectLoader<Style, Resources>(s, &r)
61 obj.font = &get_collection().get_default_font();
62 obj.font_size = obj.font->get_native_size();
65 add("font", &Loader::font);
66 add("font_color", &Loader::font_color_normal);
67 add("font_color", &Loader::font_color);
68 add("font_size", &Style::font_size);
69 add("part", &Loader::part);
70 add("part", &Loader::unnamed_part);
73 void Style::Loader::font(const string &n)
75 obj.font = &get_collection().get<GL::Font>(n);
76 obj.font_size = obj.font->get_native_size();
79 void Style::Loader::font_color_normal(float r, float g, float b)
81 font_color(NORMAL, r, g, b);
84 void Style::Loader::font_color(State s, float r, float g, float b)
86 for(unsigned i=0; i<N_STATES_; ++i)
88 obj.font_color[i] = GL::Color(r, g, b);
91 void Style::Loader::part(const string &n)
94 load_sub(p, get_collection());
95 obj.parts.push_back(p);
98 void Style::Loader::unnamed_part()