#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;
namespace battle {
-void SwapHeroes::EnterState(Application &c, SDL_Surface *screen) {
- ctrl = &c;
+void SwapHeroes::OnEnterState(SDL_Surface *screen) {
+
}
-void SwapHeroes::ExitState(Application &c, SDL_Surface *screen) {
- ctrl = 0;
+void SwapHeroes::OnExitState(SDL_Surface *screen) {
+
}
-void SwapHeroes::ResumeState(Application &ctrl, SDL_Surface *screen) {
+void SwapHeroes::OnResumeState(SDL_Surface *screen) {
}
-void SwapHeroes::PauseState(Application &ctrl, SDL_Surface *screen) {
+void SwapHeroes::OnPauseState(SDL_Surface *screen) {
}
-void SwapHeroes::Resize(int width, int height) {
+void SwapHeroes::OnResize(int width, int height) {
}
if (cursor == selected) {
selected = -1;
} else {
- ctrl->PopState();
+ Ctrl().PopState();
}
}
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);
}