10 Part::Part(const Resources &r, const string &n):
16 for(unsigned i=0; i<N_STATES_; ++i)
20 const Graphic *Part::get_graphic(State state) const
23 throw InvalidParameterValue("Invalid state");
25 return graphic[state];
28 void Part::render(const Geometry &geom, State state) const
30 const Graphic::Sides &shadow=graphic[state]->get_shadow();
31 unsigned gw=(fill_x ? geom.w : graphic[state]->get_width())-shadow.left-shadow.right;
32 unsigned gh=(fill_y ? geom.h : graphic[state]->get_height())-shadow.top-shadow.bottom;
33 align.apply(geom, gw, gh);
34 graphic[state]->render(gw, gh);
38 Part::Loader::Loader(Part &p):
41 add("graphic", &Loader::graphic);
42 add("align", &Loader::align);
43 add("fill", &Loader::fill);
46 void Part::Loader::graphic(State s, const string &n)
48 part.graphic[s]=&part.res.get_graphic(n);
51 for(unsigned i=0; i<N_STATES_; ++i)
53 part.graphic[i]=part.graphic[s];
57 void Part::Loader::align(int x, int y)
63 void Part::Loader::fill(bool x, bool y)