]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/PartyLayout.h
added battle party layout class
[l2e.git] / src / battle / PartyLayout.h
diff --git a/src/battle/PartyLayout.h b/src/battle/PartyLayout.h
new file mode 100644 (file)
index 0000000..1456f15
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * PartyLayout.h
+ *
+ *  Created on: Aug 5, 2012
+ *      Author: holy
+ */
+
+#ifndef BATTLE_PARTYLAYOUT_H_
+#define BATTLE_PARTYLAYOUT_H_
+
+#include "../geometry/Point.h"
+
+#include <vector>
+#include <SDL.h>
+
+namespace battle {
+
+class PartyLayout {
+
+public:
+       PartyLayout() { }
+
+public:
+       int NumPositions() const { return positions.size(); }
+       template<class U>
+       void CalculatePositions(U width, U height, std::vector<geometry::Point<U> > &dest) const {
+               dest.clear();
+               dest.reserve(positions.size());
+               for (std::vector<geometry::Point<Uint8> >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) {
+                       dest.push_back(geometry::Point<U>(
+                                       i->X() * 256 / width,
+                                       i->Y() * 256 / height
+                                       ));
+               }
+       }
+
+public:
+       void AddPosition(const geometry::Point<Uint8> &p) {
+               positions.push_back(p);
+       }
+
+private:
+       std::vector<geometry::Point<Uint8> > positions;
+
+};
+
+}
+
+#endif /* BATTLE_PARTYLAYOUT_H_ */