X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbattle%2Fstates%2FSelectMoveAction.cpp;h=351116bf0918e4e7aa434fcdc76accd7b412d941;hb=65158353d1ecbed0032752863c6c4eb96b1a084a;hp=4a19d48a00643e74f82b1d97a0616d8d9cc7d638;hpb=558fd3d14ad1a9dc347998691a0b300fd334a16a;p=l2e.git diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index 4a19d48..351116b 100644 --- a/src/battle/states/SelectMoveAction.cpp +++ b/src/battle/states/SelectMoveAction.cpp @@ -7,34 +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; namespace battle { -void SelectMoveAction::EnterState(app::Application &c, SDL_Surface *screen) { +void SelectMoveAction::OnEnterState(Application &c, SDL_Surface *screen) { ctrl = &c; } -void SelectMoveAction::ExitState() { +void SelectMoveAction::OnExitState(Application &c, SDL_Surface *screen) { ctrl = 0; } +void SelectMoveAction::OnResumeState(Application &ctrl, SDL_Surface *screen) { + +} + +void SelectMoveAction::OnPauseState(Application &ctrl, SDL_Surface *screen) { + +} + void SelectMoveAction::Resize(int width, int height) { } -void SelectMoveAction::HandleInput(const app::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)) { @@ -47,12 +56,13 @@ void SelectMoveAction::HandleInput(const app::Input &input) { switch (battle->GetMoveMenu().Selected()) { case MoveMenu::ATTACK: 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; } } @@ -71,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() * 3 / 4) - (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); }