X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FSelectHero.cpp;fp=src%2Fmenu%2FSelectHero.cpp;h=12690dbeabe22998d678664b359e3e4b84a52e0c;hb=17afcc24569b38a9816f616bc025ba871ad3e48e;hp=74e6f88ad9fd1a67310c653da7402dfb0f6e1dfc;hpb=559457f14d914f6b1cb5d588a0ccf97529f011d1;p=l2e.git diff --git a/src/menu/SelectHero.cpp b/src/menu/SelectHero.cpp index 74e6f88..12690db 100644 --- a/src/menu/SelectHero.cpp +++ b/src/menu/SelectHero.cpp @@ -23,8 +23,10 @@ using geometry::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 +57,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,40 +75,40 @@ 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(); } @@ -125,7 +127,7 @@ void SelectHero::Render(SDL_Surface *screen) { void SelectHero::RenderCursor(SDL_Surface *screen) const { Vector position( 0, Game().state->party[cursor]->BattleSprite()->Height()); - position += parent->StatusOffset(cursor); + position += partyMenu->StatusOffset(cursor); Res().heroCursor->Draw(screen, position); }