X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FSelectHero.cpp;h=ffc21a3bbc1a5875f39ffb87ad915ea33f4eb79a;hb=5d1a76ae7725af998c6ee46adfe492c68ee1d34f;hp=723414ff95164d051c6d5a93c3e5eb7ba4b257a1;hpb=bba1ac05e8c1854dc61bd737d228d9bc18bbb6ad;p=l2e.git diff --git a/src/menu/SelectHero.cpp b/src/menu/SelectHero.cpp index 723414f..ffc21a3 100644 --- a/src/menu/SelectHero.cpp +++ b/src/menu/SelectHero.cpp @@ -1,10 +1,3 @@ -/* - * SelectHero.cpp - * - * Created on: Oct 22, 2012 - * Author: holy - */ - #include "SelectHero.h" #include "HeroStatus.h" @@ -15,16 +8,18 @@ #include "../common/GameConfig.h" #include "../common/GameState.h" #include "../common/Hero.h" -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include "../graphics/Sprite.h" using app::Input; -using geometry::Vector; +using math::Vector; namespace menu { -SelectHero::SelectHero(PartyMenu *parent, Callback cb, int cursor) +SelectHero::SelectHero(app::State *parent, PartyMenu *pm, void *ref, Callback cb, int cursor) : parent(parent) +, partyMenu(pm) +, ref(ref) , callback(cb) , cursor(cursor) { @@ -55,7 +50,7 @@ void SelectHero::OnResize(int width, int height) { void SelectHero::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_A)) { - callback(parent, cursor); + callback(ref, cursor); } if (input.JustPressed(Input::ACTION_B)) { Ctrl().PopState(); @@ -73,44 +68,44 @@ void SelectHero::HandleEvents(const Input &input) { } void SelectHero::SelectUp() { - cursor = (cursor + 2) % parent->Game().state->partySize; + cursor = (cursor + 2) % partyMenu->Game().state->partySize; cursorBlink.Restart(); } void SelectHero::SelectRight() { - cursor = (cursor + 1) % parent->Game().state->partySize; + cursor = (cursor + 1) % partyMenu->Game().state->partySize; cursorBlink.Restart(); } void SelectHero::SelectDown() { - cursor = (cursor + 2) % parent->Game().state->partySize; + cursor = (cursor + 2) % partyMenu->Game().state->partySize; cursorBlink.Restart(); } void SelectHero::SelectLeft() { - cursor = (cursor + 3) % parent->Game().state->partySize; + cursor = (cursor + 3) % partyMenu->Game().state->partySize; cursorBlink.Restart(); } common::GameConfig &SelectHero::Game() { - return parent->Game(); + return partyMenu->Game(); } const common::GameConfig &SelectHero::Game() const { - return parent->Game(); + return partyMenu->Game(); } Resources &SelectHero::Res() { - return parent->Res(); + return partyMenu->Res(); } const Resources &SelectHero::Res() const { - return parent->Res(); + return partyMenu->Res(); } -void SelectHero::UpdateWorld(float deltaT) { +void SelectHero::UpdateWorld(Uint32 deltaT) { } @@ -123,10 +118,9 @@ void SelectHero::Render(SDL_Surface *screen) { } void SelectHero::RenderCursor(SDL_Surface *screen) const { - const HeroStatus &status(parent->GetHeroStatus(cursor)); Vector position( 0, Game().state->party[cursor]->BattleSprite()->Height()); - position += status.Position() + parent->StatusOffset(); + position += partyMenu->StatusOffset(cursor); Res().heroCursor->Draw(screen, position); }