10 Part::Part(const string &n):
17 for(unsigned i=0; i<N_STATES_; ++i)
21 const Graphic *Part::get_graphic(State state) const
24 throw InvalidParameterValue("Invalid state");
26 return graphic[state];
29 void Part::render(const Geometry &geom, State state) const
31 unsigned gw=(fill_x ? geom.w : width);
32 unsigned gh=(fill_y ? geom.h : height);
33 align.apply(geom, gw, gh);
34 graphic[state]->render(gw, gh);
38 Part::Loader::Loader(Part &p, Resources &r):
42 add("graphic", &Loader::graphic);
43 add("align", &Loader::align);
44 add("fill", &Loader::fill);
47 Part::Loader::~Loader()
49 for(unsigned i=0; i<N_STATES_; ++i)
53 const Sides &shadow=part.graphic[i]->get_shadow();
54 part.width=max(part.width, part.graphic[i]->get_width()-shadow.left-shadow.right);
55 part.height=max(part.height, part.graphic[i]->get_height()-shadow.bottom-shadow.top);
58 part.graphic[i]=part.graphic[NORMAL];
62 void Part::Loader::graphic(State s, const string &n)
64 part.graphic[s]=&res.get<Graphic>(n);
67 void Part::Loader::align(int x, int y)
73 void Part::Loader::fill(bool x, bool y)