]> git.localhorst.tv Git - l2e.git/blob - src/battle/PartyLayout.h
changed party layout position interpretation to better reflect the original game
[l2e.git] / src / battle / PartyLayout.h
1 /*
2  * PartyLayout.h
3  *
4  *  Created on: Aug 5, 2012
5  *      Author: holy
6  */
7
8 #ifndef BATTLE_PARTYLAYOUT_H_
9 #define BATTLE_PARTYLAYOUT_H_
10
11 #include "../geometry/Point.h"
12
13 #include <vector>
14 #include <SDL.h>
15
16 namespace battle {
17
18 class PartyLayout {
19
20 public:
21         PartyLayout() { }
22
23 public:
24         std::vector<geometry::Point<Uint8> >::size_type NumPositions() const { return positions.size(); }
25         template<class U>
26         void CalculatePositions(U width, U height, std::vector<geometry::Point<U> > &dest) const {
27                 dest.clear();
28                 dest.reserve(positions.size());
29                 for (std::vector<geometry::Point<Uint8> >::const_iterator i(positions.begin()), end(positions.end()); i != end; ++i) {
30                         dest.push_back(geometry::Point<U>(
31                                         i->X() * width / 255,
32                                         i->Y() * height / 223
33                                         ));
34                 }
35         }
36
37 public:
38         void AddPosition(const geometry::Point<Uint8> &p) {
39                 positions.push_back(p);
40         }
41
42 private:
43         std::vector<geometry::Point<Uint8> > positions;
44
45 };
46
47 }
48
49 #endif /* BATTLE_PARTYLAYOUT_H_ */