]> git.localhorst.tv Git - l2e.git/commitdiff
added basic config menu
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 29 Nov 2012 13:34:42 +0000 (14:34 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 29 Nov 2012 13:34:42 +0000 (14:34 +0100)
src/main.cpp
src/menu/ConfigMenu.cpp
src/menu/ConfigMenu.h
src/menu/Resources.cpp
src/menu/Resources.h

index 22a354e6785b24621d98783496104f4eff440621..68446d3f499518d5bc129f3475f1585ecda160ee 100644 (file)
@@ -441,6 +441,28 @@ int main(int argc, char **argv) {
                menuResources.equipMenuRemoveAllLabel = "REMOVE ALL";
                menuResources.equipMenuDropLabel = "DROP";
 
+               graphics::MenuProperties configMenuProperties;
+               configMenuProperties.cols = 1;
+               configMenuProperties.rows = 4;
+               configMenuProperties.charsPerEntry = 8;
+               configMenuProperties.rowGap = 32;
+               configMenuProperties.cursor = &menuCursor;
+               configMenuProperties.font = &menuFont;
+               configMenuProperties.wrapY = true;
+               menuResources.configMenuProperties = &configMenuProperties;
+
+               menuResources.configMessageSpeedLabel = "MESSAGE\n   SPEED";
+               menuResources.configMessageSpeedFast = "FAST";
+               menuResources.configMessageSpeedNormal = "NORMAL";
+               menuResources.configMessageSpeedSlow = "SLOW";
+               menuResources.configBattleCursorLabel = "BATTLE\n  CURSOR";
+               menuResources.configStatusCursorLabel = "STATUS\n  CURSOR";
+               menuResources.configCursorClear = "CLEAR";
+               menuResources.configCursorMemory = "MEMORY";
+               menuResources.configMusicLabel = "MUSIC";
+               menuResources.configMusicStereo = "STEREO";
+               menuResources.configMusicMono = "MONO";
+
                InitScreen screen(width, height);
 
                app::State *state(0);
index 1e27973e94e954f78957227c5263765e52dc16de..62eed325d0ff33b40ebe2b1d29bf3e714fc64d43 100644 (file)
@@ -22,8 +22,12 @@ using graphics::Frame;
 namespace menu {
 
 ConfigMenu::ConfigMenu(PartyMenu *parent)
-: parent(parent) {
-
+: parent(parent)
+, configMenu(*parent->Res().configMenuProperties) {
+       configMenu.Add(parent->Res().configMessageSpeedLabel, 0);
+       configMenu.Add(parent->Res().configBattleCursorLabel, 1);
+       configMenu.Add(parent->Res().configStatusCursorLabel, 2);
+       configMenu.Add(parent->Res().configMusicLabel, 3);
 }
 
 
@@ -62,6 +66,12 @@ void ConfigMenu::HandleEvents(const Input &input) {
        if (input.JustPressed(Input::ACTION_B)) {
                Ctrl().PopState();
        }
+       if (input.JustPressed(Input::PAD_DOWN)) {
+               configMenu.NextRow();
+       }
+       if (input.JustPressed(Input::PAD_UP)) {
+               configMenu.PreviousRow();
+       }
 }
 
 void ConfigMenu::UpdateWorld(float deltaT) {
@@ -94,8 +104,11 @@ void ConfigMenu::RenderHeadline(SDL_Surface *screen, const geometry::Vector<int>
 void ConfigMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
        const Font &font(*parent->Res().normalFont);
        const Frame &frame(*parent->Res().statusFrame);
+       const Vector<int> menuOffset(
+                       3 * font.CharWidth(), 2 * font.CharHeight());
 
        frame.Draw(screen, offset, 30 * font.CharWidth(), 14 * font.CharHeight());
+       configMenu.Draw(screen, offset + menuOffset);
 }
 
 }
index c3f96f0cc108d283b4e1eb0f4d4d46d4cf9003dd..8bb81f40e0414f836d90f9b4d3103dba09aede78 100644 (file)
@@ -11,6 +11,7 @@
 #include "fwd.h"
 #include "../app/State.h"
 #include "../geometry/Vector.h"
+#include "../graphics/Menu.h"
 
 namespace menu {
 
@@ -42,6 +43,7 @@ private:
 
 private:
        PartyMenu *parent;
+       graphics::Menu<int> configMenu;
 
 };
 
index 8b36b252f007524a7461e0f2b32d9450ade402d9..14158f3b9ae2ce14dca093f3b41ea15d5a5637cf 100644 (file)
@@ -72,7 +72,20 @@ Resources::Resources()
 , equipMenuStrongestLabel(0)
 , equipMenuRemoveLabel(0)
 , equipMenuRemoveAllLabel(0)
-, equipMenuDropLabel(0) {
+, equipMenuDropLabel(0)
+
+, configMenuProperties(0)
+, configMessageSpeedLabel(0)
+, configMessageSpeedFast(0)
+, configMessageSpeedNormal(0)
+, configMessageSpeedSlow(0)
+, configBattleCursorLabel(0)
+, configStatusCursorLabel(0)
+, configCursorClear(0)
+, configCursorMemory(0)
+, configMusicLabel(0)
+, configMusicStereo(0)
+, configMusicMono(0) {
 
 }
 
index acc99ad3a6bbcc076c5ee9dbf569a47691c7ee35..8778cb5a27420afd56acd2d2b132d11e68612045 100644 (file)
@@ -79,6 +79,19 @@ struct Resources {
        const char *equipMenuRemoveAllLabel;
        const char *equipMenuDropLabel;
 
+       graphics::MenuProperties *configMenuProperties;
+       const char *configMessageSpeedLabel;
+       const char *configMessageSpeedFast;
+       const char *configMessageSpeedNormal;
+       const char *configMessageSpeedSlow;
+       const char *configBattleCursorLabel;
+       const char *configStatusCursorLabel;
+       const char *configCursorClear;
+       const char *configCursorMemory;
+       const char *configMusicLabel;
+       const char *configMusicStereo;
+       const char *configMusicMono;
+
        Resources();
 
 };