X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FRunState.cpp;h=956fa133ec1317329a41bce85e23f1d4d448187e;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=1a90e280f5f9af70c10478a22470fa9df0ddc825;hpb=04b582180c8f86f50f08f5141a2514a1fcda3e01;p=l2e.git diff --git a/src/battle/states/RunState.cpp b/src/battle/states/RunState.cpp index 1a90e28..956fa13 100644 --- a/src/battle/states/RunState.cpp +++ b/src/battle/states/RunState.cpp @@ -10,8 +10,7 @@ #include "../BattleState.h" #include "../../app/Application.h" #include "../../app/Input.h" -#include "../../geometry/operators.h" -#include "../../geometry/Point.h" +#include "../../math/Vector.h" #include "../../graphics/Font.h" #include "../../graphics/Frame.h" @@ -19,30 +18,28 @@ using app::Application; using app::Input; -using geometry::Point; -using geometry::Vector; +using math::Vector; namespace battle { -void RunState::EnterState(Application &c, SDL_Surface *screen) { - ctrl = &c; - // TODO: push battle animation if enemy is faster +void RunState::OnEnterState(SDL_Surface *screen) { + } -void RunState::ExitState(Application &c, SDL_Surface *screen) { - ctrl = 0; +void RunState::OnExitState(SDL_Surface *screen) { + } -void RunState::ResumeState(Application &ctrl, SDL_Surface *screen) { +void RunState::OnResumeState(SDL_Surface *screen) { timer = GraphicsTimers().StartCountdown(2500); } -void RunState::PauseState(Application &ctrl, SDL_Surface *screen) { +void RunState::OnPauseState(SDL_Surface *screen) { } -void RunState::Resize(int width, int height) { +void RunState::OnResize(int width, int height) { } @@ -50,12 +47,12 @@ void RunState::Resize(int width, int height) { void RunState::HandleEvents(const Input &input) { if (timer.Finished()) { battle->SetRunaway(); - ctrl->PopState(); // pop self + Ctrl().PopState(); // pop self } } -void RunState::UpdateWorld(float deltaT) { +void RunState::UpdateWorld(Uint32 deltaT) { } @@ -70,10 +67,10 @@ void RunState::Render(SDL_Surface *screen) { void RunState::RenderTitleBar(SDL_Surface *screen, const Vector &offset) { int height(battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight()); - battle->Res().titleFrame->Draw(screen, Point(offset.X(), offset.Y()), battle->BackgroundWidth(), height); + battle->Res().titleFrame->Draw(screen, offset, battle->Width(), height); - Point textPosition( - (battle->BackgroundWidth() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2, + Vector textPosition( + (battle->Width() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2, battle->Res().titleFrame->BorderHeight()); battle->Res().titleFont->DrawString(battle->Res().escapeText, screen, textPosition + offset); }