X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectMoveAction.cpp;h=74e86281c3761097bc75e149e41ce51fed696c7c;hb=a3ba4dc677ad7c92eeb78b20b642241563605c9d;hp=c728db0e61c6bd51502329e2ba7a84026d0fa7c1;hpb=185c6c79f8ba30981aad4e1d66f98143a344b95e;p=l2e.git diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index c728db0..74e8628 100644 --- a/src/battle/states/SelectMoveAction.cpp +++ b/src/battle/states/SelectMoveAction.cpp @@ -7,43 +7,43 @@ #include "SelectMoveAction.h" +#include "RunState.h" #include "SelectAttackType.h" +#include "SwapHeroes.h" #include "../BattleState.h" #include "../MoveMenu.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" using app::Application; using app::Input; -using geometry::Point; -using geometry::Vector; +using math::Vector; namespace battle { -void SelectMoveAction::EnterState(Application &c, SDL_Surface *screen) { - ctrl = &c; +void SelectMoveAction::OnEnterState(SDL_Surface *screen) { + } -void SelectMoveAction::ExitState(Application &c, SDL_Surface *screen) { - ctrl = 0; +void SelectMoveAction::OnExitState(SDL_Surface *screen) { + } -void SelectMoveAction::ResumeState(Application &ctrl, SDL_Surface *screen) { +void SelectMoveAction::OnResumeState(SDL_Surface *screen) { } -void SelectMoveAction::PauseState(Application &ctrl, SDL_Surface *screen) { +void SelectMoveAction::OnPauseState(SDL_Surface *screen) { } -void SelectMoveAction::Resize(int width, int height) { +void SelectMoveAction::OnResize(int width, int height) { } -void SelectMoveAction::HandleInput(const Input &input) { +void SelectMoveAction::HandleEvents(const Input &input) { if (input.IsDown(Input::PAD_UP)) { battle->GetMoveMenu().Select(MoveMenu::CHANGE); } else if (input.IsDown(Input::PAD_DOWN)) { @@ -55,14 +55,14 @@ void SelectMoveAction::HandleInput(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { switch (battle->GetMoveMenu().Selected()) { case MoveMenu::ATTACK: - ctrl->ChangeState(new SelectAttackType(battle)); + Ctrl().ChangeState(new SelectAttackType(battle)); battle->NextHero(); break; case MoveMenu::CHANGE: - // TODO: switch to change state + Ctrl().PushState(new SwapHeroes(battle, this)); break; case MoveMenu::RUN: - // TODO: switch to run state + Ctrl().ChangeState(new RunState(battle)); break; } } @@ -81,9 +81,9 @@ void SelectMoveAction::Render(SDL_Surface *screen) { } void SelectMoveAction::RenderMenu(SDL_Surface *screen, const Vector &offset) { - Point position( - (battle->BackgroundWidth() - battle->GetMoveMenu().Width()) / 2, - battle->BackgroundHeight() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2); + Vector position( + (battle->Width() - battle->GetMoveMenu().Width()) / 2, + battle->Height() - battle->GetMoveMenu().Height() - battle->GetMoveMenu().Height() / 2); battle->GetMoveMenu().Render(screen, position + offset); }