X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectTarget.cpp;h=c685dab8947108aa78b83d0a794fdac07da6fba9;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=591da6753972350cf1eb9f0f44041a8df2023368;hpb=9718062e6ed305d9f8f1674ff172079688e78088;p=l2e.git diff --git a/src/battle/states/SelectTarget.cpp b/src/battle/states/SelectTarget.cpp index 591da67..c685dab 100644 --- a/src/battle/states/SelectTarget.cpp +++ b/src/battle/states/SelectTarget.cpp @@ -11,35 +11,33 @@ #include "../BattleState.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" +#include "../../math/Vector.h" using app::Application; using app::Input; -using geometry::Point; -using geometry::Vector; +using math::Vector; using std::vector; namespace battle { -void SelectTarget::EnterState(Application &c, SDL_Surface *screen) { - ctrl = &c; +void SelectTarget::OnEnterState(SDL_Surface *screen) { + } -void SelectTarget::ExitState(Application &c, SDL_Surface *screen) { - ctrl = 0; +void SelectTarget::OnExitState(SDL_Surface *screen) { + } -void SelectTarget::ResumeState(Application &ctrl, SDL_Surface *screen) { +void SelectTarget::OnResumeState(SDL_Surface *screen) { } -void SelectTarget::PauseState(Application &ctrl, SDL_Surface *screen) { +void SelectTarget::OnPauseState(SDL_Surface *screen) { } -void SelectTarget::Resize(int width, int height) { +void SelectTarget::OnResize(int width, int height) { } @@ -47,11 +45,11 @@ void SelectTarget::Resize(int width, int height) { void SelectTarget::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { if (selection->CurrentIsSelected()) { - ctrl->PopState(); // return control to parent + Ctrl().PopState(); // return control to parent } else { selection->Select(); if (selection->SelectSingle()) { - ctrl->PopState(); // return control to parent + Ctrl().PopState(); // return control to parent } } } @@ -60,7 +58,7 @@ void SelectTarget::HandleEvents(const Input &input) { selection->Unselect(); } else { selection->UnselectAll(); - ctrl->PopState(); // return control to parent + Ctrl().PopState(); // return control to parent } } @@ -78,7 +76,7 @@ void SelectTarget::HandleEvents(const Input &input) { } } -void SelectTarget::UpdateWorld(float deltaT) { +void SelectTarget::UpdateWorld(Uint32 deltaT) { } @@ -88,13 +86,12 @@ void SelectTarget::Render(SDL_Surface *screen) { RenderCursors(screen, offset); } -void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector &offset) { - // TODO: this should be related to the enemy's width +void SelectTarget::RenderCursors(SDL_Surface *screen, const math::Vector &offset) { Vector cursorOffset(cursorIcon->Width() / -2, cursorIcon->Height()); // offset the indicator by 1/8th to the right and top Vector indicatorOffset(cursorOffset + Vector(cursorIcon->Width() / 8, cursorIcon->Height() / -8)); - vector > positions; - if (selection->TargetsEnemies()) { + vector > positions; + if (selection->TargetsMonsters()) { for (int i(0), end(battle->MaxMonsters()); i < end; ++i) { positions.push_back(battle->MonsterAt(i).Position()); } @@ -104,7 +101,7 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector >::size_type i(0); i < positions.size(); ++i) { + for (vector >::size_type i(0); i < positions.size(); ++i) { if (selection->IsSelected(i)) { cursorIcon->DrawTopRight(screen, positions[i] + indicatorOffset + offset); }