X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FSelectMoveAction.cpp;h=b77f98c1a2459a7da7aa9e80bfb590542f6a89cc;hb=5d1a76ae7725af998c6ee46adfe492c68ee1d34f;hp=54f0f297661f2654ef49ffb82ed463b07ec57c98;hpb=4d0a650b178d81387caa36953ed06cc5d6c28213;p=l2e.git diff --git a/src/battle/states/SelectMoveAction.cpp b/src/battle/states/SelectMoveAction.cpp index 54f0f29..b77f98c 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; +using math::Vector; namespace battle { -void SelectMoveAction::EnterState(app::Application &c, SDL_Surface *screen) { - ctrl = &c; +void SelectMoveAction::OnEnterState(SDL_Surface *screen) { + +} + +void SelectMoveAction::OnExitState(SDL_Surface *screen) { + } -void SelectMoveAction::ExitState() { - ctrl = 0; +void SelectMoveAction::OnResumeState(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 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)) { @@ -46,20 +55,20 @@ void SelectMoveAction::HandleInput(const app::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; } } } -void SelectMoveAction::UpdateWorld(float deltaT) { +void SelectMoveAction::UpdateWorld(Uint32 deltaT) { } @@ -72,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); }