4 * Created on: Aug 5, 2012
8 #include "PartyLayout.h"
10 #include "../loader/TypeDescription.h"
12 using geometry::Vector;
13 using loader::FieldDescription;
14 using loader::TypeDescription;
19 Vector<int> PartyLayout::CalculatePosition(int index, int width, int height) const {
20 assert(index >= 0 && index < numPositions);
22 positions[index].X() * width / 255,
23 positions[index].Y() * height / 223
27 void PartyLayout::CalculatePositions(int width, int height, vector<Vector<int> > &dest) const {
29 dest.reserve(numPositions);
30 for (int i(0); i < numPositions; ++i) {
31 dest.push_back(Vector<int>(
32 positions[i].X() * width / 255,
33 positions[i].Y() * height / 223
39 void PartyLayout::CreateTypeDescription() {
41 TypeDescription &td(TypeDescription::CreateOrGet("PartyLayout"));
43 td.SetSize(sizeof(PartyLayout));
45 int vectorId(TypeDescription::GetTypeId("Vector"));
47 td.AddField("positions", FieldDescription(((char *)&p.positions) - ((char *)&p), vectorId, true, true));