From: Daniel Karbach Date: Wed, 8 Aug 2012 21:00:41 +0000 (+0200) Subject: moved spell menu template to resources X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=ad88c8db0051fd6d9082fc61a124efd407113632;p=l2e.git moved spell menu template to resources --- diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 15d9d18..d1cb4ff 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -51,14 +51,19 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) { heroesLayout->CalculatePositions(background->w, background->h, heroesPositions); attackChoices.resize(heroes.size()); for (vector::size_type i(0), end(heroes.size()); i < end; ++i) { - // TODO: extract menu dimensions to resources - Menu spellMenu(res->normalFont, 12, 6, 8, 2, 32); - spellMenu.Add("Strong : 3", 0); - spellMenu.Add("Stronger : 8", 0); - spellMenu.Add("Champion :16", 0); - spellMenu.Add("Rally :10", 0); - spellMenu.Add("Valor :30", 0); - spellMenus.push_back(spellMenu); + spellMenus.push_back(res->spellMenuPrototype); + // TODO: insert real spell menu entries + spellMenus.back().Add("Reset : 0", 0); + spellMenus.back().Add("Strong : 3", 0); + spellMenus.back().Add("Stronger : 8", 0); + spellMenus.back().Add("Champion :16", 0); + spellMenus.back().Add("Rally :10", 0); + spellMenus.back().Add("Valor :30", 0); + spellMenus.back().Add("Poison : 2", 0); + spellMenus.back().Add("Release : 2", 0); + spellMenus.back().Add("Waken : 4", 0); + spellMenus.back().Add("Fake : 4", 0); + spellMenus.back().Add("Trick : 5", 0); heroTags.push_back(HeroTag(&heroes[i], &attackChoices[i], res, HeroTag::Alignment((i + 1) % 2))); } } diff --git a/src/battle/Resources.h b/src/battle/Resources.h index 8d1144f..40c0b3b 100644 --- a/src/battle/Resources.h +++ b/src/battle/Resources.h @@ -8,6 +8,8 @@ #ifndef BATTLE_RESOURCES_H_ #define BATTLE_RESOURCES_H_ +#include "../graphics/Menu.h" + namespace graphics { class Font; class Frame; @@ -36,6 +38,8 @@ struct Resources { graphics::Font *normalFont; + graphics::Menu spellMenuPrototype; + Resources() : moveIcons(0) diff --git a/src/graphics/Menu.h b/src/graphics/Menu.h index 0a4a698..576120e 100644 --- a/src/graphics/Menu.h +++ b/src/graphics/Menu.h @@ -20,11 +20,14 @@ namespace graphics { class Sprite; +// TODO: disabled entries + alternate font for those +// TODO: sprite for the cursor +// TODO: animation when top row changes template class Menu { public: - Menu(const Font *font, int charsPerEntry, int rows, int rowGap = 0, int cols = 1, int colGap = 0); + explicit Menu(const Font *font = NULL, int charsPerEntry = 16, int rows = 1, int rowGap = 0, int cols = 1, int colGap = 0); public: int Width() const; diff --git a/src/main.cpp b/src/main.cpp index 676f2d7..f5d32e4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,7 @@ #include "graphics/Font.h" #include "graphics/Frame.h" #include "graphics/Gauge.h" +#include "graphics/Menu.h" #include "graphics/Sprite.h" #include "sdl/InitImage.h" #include "sdl/InitScreen.h" @@ -36,6 +37,7 @@ using geometry::Point; using graphics::Font; using graphics::Frame; using graphics::Gauge; +using graphics::Menu; using graphics::Sprite; using sdl::InitImage; using sdl::InitScreen; @@ -166,6 +168,8 @@ int main(int argc, char **argv) { normalFont.MapChar('?', 10, 0); battleRes.normalFont = &normalFont; + battleRes.spellMenuPrototype = Menu(&normalFont, 12, 6, 8, 2, 32); + BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes)); battleState->AddMonster(monster); battleState->AddMonster(monster);