From: Daniel Karbach Date: Wed, 8 Aug 2012 21:12:15 +0000 (+0200) Subject: added spell menu's headline X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;ds=sidebyside;h=4bdbcf13343cee3f4fcc4ed7057e18eb6fe49703;p=l2e.git added spell menu's headline --- diff --git a/src/battle/Resources.h b/src/battle/Resources.h index 40c0b3b..2de6b69 100644 --- a/src/battle/Resources.h +++ b/src/battle/Resources.h @@ -38,6 +38,7 @@ struct Resources { graphics::Font *normalFont; + const char *spellMenuHeadline; graphics::Menu spellMenuPrototype; @@ -58,6 +59,8 @@ struct Resources { , selectFrame(0) , normalFont(0) + + , spellMenuHeadline("") { } }; diff --git a/src/battle/states/SelectSpell.cpp b/src/battle/states/SelectSpell.cpp index 5f358fb..713c3d5 100644 --- a/src/battle/states/SelectSpell.cpp +++ b/src/battle/states/SelectSpell.cpp @@ -65,6 +65,7 @@ void SelectSpell::Render(SDL_Surface *screen) { parent->Render(screen); Vector offset(battle->CalculateScreenOffset(screen)); RenderFrame(screen, offset); + RenderHeadline(screen, offset); RenderMenu(screen, offset); } @@ -77,8 +78,19 @@ void SelectSpell::RenderFrame(SDL_Surface *screen, const Vector &offset) { frame->Draw(screen, position + offset, width, height); } +void SelectSpell::RenderHeadline(SDL_Surface *screen, const Vector &offset) { + const Resources &res(battle->Res()); + Point position( + 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), + 2 * res.selectFrame->BorderHeight()); + res.normalFont->DrawString(res.spellMenuHeadline, screen, position + offset); +} + void SelectSpell::RenderMenu(SDL_Surface *screen, const Vector &offset) { - Point position(2 * battle->Res().selectFrame->BorderWidth(), 2 * battle->Res().selectFrame->BorderHeight()); + const Resources &res(battle->Res()); + Point position( + 2 * res.selectFrame->BorderWidth() + res.normalFont->CharWidth(), + 2 * res.selectFrame->BorderHeight() + 2 * res.normalFont->CharHeight()); battle->GetSpellMenu().Draw(screen, position + offset); } diff --git a/src/battle/states/SelectSpell.h b/src/battle/states/SelectSpell.h index f3841a1..eda7e91 100644 --- a/src/battle/states/SelectSpell.h +++ b/src/battle/states/SelectSpell.h @@ -38,6 +38,7 @@ public: private: void RenderFrame(SDL_Surface *, const geometry::Vector &offset); + void RenderHeadline(SDL_Surface *, const geometry::Vector &offset); void RenderMenu(SDL_Surface *, const geometry::Vector &offset); private: diff --git a/src/main.cpp b/src/main.cpp index f5d32e4..22c43cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,8 +166,10 @@ int main(int argc, char **argv) { normalFont.MapChar(':', 10, 0); normalFont.MapChar('!', 10, 0); normalFont.MapChar('?', 10, 0); + // TODO: add '.' character battleRes.normalFont = &normalFont; + battleRes.spellMenuHeadline = "Please choose a spell."; battleRes.spellMenuPrototype = Menu(&normalFont, 12, 6, 8, 2, 32); BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));