10 Part::Part(const Resources &r, const string &n):
18 for(unsigned i=0; i<N_STATES_; ++i)
22 const Graphic *Part::get_graphic(State state) const
25 throw InvalidParameterValue("Invalid state");
27 return graphic[state];
30 void Part::render(const Geometry &geom, State state) const
32 unsigned gw=(fill_x ? geom.w : width);
33 unsigned gh=(fill_y ? geom.h : height);
34 align.apply(geom, gw, gh);
35 graphic[state]->render(gw, gh);
39 Part::Loader::Loader(Part &p):
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]=&part.res.get_graphic(n);
67 void Part::Loader::align(int x, int y)
73 void Part::Loader::fill(bool x, bool y)