#include "../BattleState.h"
#include "../../app/Application.h"
#include "../../app/Input.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
using app::Application;
using app::Input;
-using geometry::Point;
using geometry::Vector;
using std::vector;
}
-void SwapHeroes::HandleInput(const Input &input) {
+void SwapHeroes::HandleEvents(const Input &input) {
if (input.JustPressed(Input::ACTION_A)) {
if (selected != -1 && cursor != selected) {
battle->SwapHeroes(cursor, selected);
if (cursor > 0) {
--cursor;
} else {
- cursor = battle->Heroes().size();
+ cursor = battle->NumHeroes();
}
}
// offset the cursor by 1/8th to the left and bottom
Vector<int> cursorOffset(battle->Res().swapCursor->Width() / -8, battle->Res().swapCursor->Height() / 8);
Vector<int> indicatorOffset(0, 0);
- vector<Point<int> > positions;
- for (vector<Hero>::size_type i(0), end(battle->Heroes().size()); i < end; ++i) {
+ vector<Vector<int> > positions;
+ for (int i(0), end(battle->NumHeroes()); i < end; ++i) {
Vector<int> positionCorrection(battle->Res().swapCursor->Width() / 2, battle->HeroTagAt(i).HeroSprite()->Height() - battle->Res().swapCursor->Height() / 2);
// indicator offsets are inverted for heroes
positionCorrection -= cursorOffset;
positions.push_back(battle->HeroTagPositionAt(i) + battle->HeroTagAt(i).HeroOffset() + positionCorrection);
}
if (flipFlop) {
- for (vector<Point<int> >::size_type i(0); i < positions.size(); ++i) {
+ for (vector<Vector<int> >::size_type i(0); i < positions.size(); ++i) {
if (selected == int(i)) {
battle->Res().swapCursor->DrawTopRight(screen, positions[i] + offset);
}