X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmenu%2FPartyMenu.cpp;fp=src%2Fmenu%2FPartyMenu.cpp;h=5a68ca4fa5c3eac66b39055f18d28e861b29f2e6;hb=aedf4ae020e3c811341df79ceae63ca56fb7ce83;hp=4949bfaa73453a546062bf121de197f287794077;hpb=7e59a87ac7caf96ffa38f2595581a6009a20339a;p=l2e.git diff --git a/src/menu/PartyMenu.cpp b/src/menu/PartyMenu.cpp index 4949bfa..5a68ca4 100644 --- a/src/menu/PartyMenu.cpp +++ b/src/menu/PartyMenu.cpp @@ -24,7 +24,8 @@ using geometry::Vector; namespace menu { PartyMenu::PartyMenu(GameConfig *game) -: game(game) { +: game(game) +, mainMenu(*game->menuResources->mainMenuProperties) { for (int i(0); i < 4; ++i) { status[i].SetHero(game->state->party[i]); status[i].SetResources(game->menuResources); @@ -32,6 +33,15 @@ PartyMenu::PartyMenu(GameConfig *game) status[1].SetPosition(Vector(status[0].Width() + Res().normalFont->CharWidth(), 0)); status[2].SetPosition(Vector(0, status[0].Height() + Res().normalFont->CharHeight())); status[3].SetPosition(Vector(status[0].Width() + Res().normalFont->CharWidth(), status[0].Height() + Res().normalFont->CharHeight())); + + mainMenu.Add(Res().mainMenuItemText, 0); + mainMenu.Add(Res().mainMenuStatusText, 4); + mainMenu.Add(Res().mainMenuSpellText, 1); + mainMenu.Add(Res().mainMenuChangeText, 5); + mainMenu.Add(Res().mainMenuCapsuleText, 2); + mainMenu.Add(Res().mainMenuConfigText, 6); + mainMenu.Add(Res().mainMenuEquipmentText, 3); + mainMenu.Add(Res().mainMenuScenarioText, 7); } PartyMenu::~PartyMenu() { @@ -66,6 +76,16 @@ void PartyMenu::HandleEvents(const Input &input) { Ctrl().PopState(); return; } + + if (input.JustPressed(Input::PAD_UP)) { + mainMenu.PreviousRow(); + } else if (input.JustPressed(Input::PAD_RIGHT)) { + mainMenu.NextItem(); + } else if (input.JustPressed(Input::PAD_DOWN)) { + mainMenu.NextRow(); + } else if (input.JustPressed(Input::PAD_LEFT)) { + mainMenu.PreviousItem(); + } } void PartyMenu::UpdateWorld(float deltaT) { @@ -79,18 +99,42 @@ void PartyMenu::Render(SDL_Surface *screen) { RenderInfo(screen, Vector(14 * Res().normalFont->CharWidth(), 21 * Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 8)); } -void PartyMenu::RenderHeros(SDL_Surface *screen, const geometry::Vector &offset) const { +void PartyMenu::RenderHeros(SDL_Surface *screen, const Vector &offset) const { for (int i(0); i < 4; ++i) { status[i].Render(screen, offset); } } -void PartyMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const { +void PartyMenu::RenderMenu(SDL_Surface *screen, const Vector &offset) const { + Vector menuOffset(3 * Res().normalFont->CharWidth(), Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 4); + Res().statusFrame->Draw(screen, offset, 23 * Res().normalFont->CharWidth(), 8 * Res().normalFont->CharHeight()); + mainMenu.Draw(screen, offset + menuOffset); } -void PartyMenu::RenderInfo(SDL_Surface *screen, const geometry::Vector &offset) const { +void PartyMenu::RenderInfo(SDL_Surface *screen, const Vector &offset) const { Res().statusFrame->Draw(screen, offset, 17 * Res().normalFont->CharWidth(), 5 * Res().normalFont->CharHeight()); + + Vector timeLabelOffset(2 * Res().normalFont->CharWidth(), Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 4); + Res().normalFont->DrawString(Res().mainMenuTimeText, screen, offset + timeLabelOffset); + + Vector hoursOffset(timeLabelOffset.X() + 6 * Res().normalFont->CharWidth(), timeLabelOffset.Y()); + Res().normalFont->DrawNumber(game->state->time / 60 / 60, screen, offset + hoursOffset, 4); + + Vector timeSeparatorOffset(hoursOffset.X() + 4 * Res().normalFont->CharWidth(), hoursOffset.Y()); + Res().normalFont->DrawChar(':', screen, offset + timeSeparatorOffset); + + Vector minutesOffset(timeSeparatorOffset.X() + Res().normalFont->CharWidth(), timeSeparatorOffset.Y()); + Res().normalFont->DrawNumber(game->state->time / 60, screen, offset + minutesOffset, 2); + if (game->state->time / 60 < 10) { + Res().normalFont->DrawChar('0', screen, offset + minutesOffset); + } + + Vector goldLabelOffset(2 * Res().normalFont->CharWidth(), 2 * Res().normalFont->CharHeight() + Res().normalFont->CharHeight() * 3 / 4); + Res().normalFont->DrawString(Res().mainMenuGoldText, screen, offset + goldLabelOffset); + + Vector goldOffset(goldLabelOffset.X() + 6 * Res().normalFont->CharWidth(), goldLabelOffset.Y()); + Res().normalFont->DrawNumber(game->state->money, screen, offset + goldOffset, 7); }