From 842f1dac6934a75820e387f3ff84d491030dfe5d Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Sun, 10 Apr 2011 20:03:38 +0000 Subject: [PATCH] menu structure changed --- .../glest_game/menu/menu_state_join_game.cpp | 4 +- .../menu/menu_state_masterserver.cpp | 4 +- .../glest_game/menu/menu_state_masterserver.h | 2 +- .../glest_game/menu/menu_state_new_game.cpp | 37 ++++++++++++++++--- source/glest_game/menu/menu_state_new_game.h | 4 +- source/glest_game/menu/menu_state_root.cpp | 26 +------------ source/glest_game/menu/menu_state_root.h | 4 +- 7 files changed, 42 insertions(+), 39 deletions(-) diff --git a/source/glest_game/menu/menu_state_join_game.cpp b/source/glest_game/menu/menu_state_join_game.cpp index f51a87310..e2f16b2c6 100644 --- a/source/glest_game/menu/menu_state_join_game.cpp +++ b/source/glest_game/menu/menu_state_join_game.cpp @@ -16,7 +16,7 @@ #include "sound_renderer.h" #include "core_data.h" #include "config.h" -#include "menu_state_root.h" +#include "menu_state_new_game.h" #include "metrics.h" #include "network_manager.h" #include "network_message.h" @@ -241,7 +241,7 @@ void MenuStateJoinGame::mouseClick(int x, int y, MouseButton mouseButton) { clientInterface->close(); } abortAutoFind = true; - mainMenu->setState(new MenuStateRoot(program, mainMenu)); + mainMenu->setState(new MenuStateNewGame(program, mainMenu)); } //connect diff --git a/source/glest_game/menu/menu_state_masterserver.cpp b/source/glest_game/menu/menu_state_masterserver.cpp index d2c03c6ba..89ae8db7a 100644 --- a/source/glest_game/menu/menu_state_masterserver.cpp +++ b/source/glest_game/menu/menu_state_masterserver.cpp @@ -18,7 +18,7 @@ #include "config.h" #include "menu_state_connected_game.h" #include "menu_state_custom_game.h" -#include "menu_state_root.h" +#include "menu_state_new_game.h" #include "metrics.h" #include "network_manager.h" #include "network_message.h" @@ -414,7 +414,7 @@ void MenuStateMasterserver::mouseClick(int x, int y, MouseButton mouseButton){ if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - mainMenu->setState(new MenuStateRoot(program, mainMenu)); + mainMenu->setState(new MenuStateNewGame(program, mainMenu)); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } diff --git a/source/glest_game/menu/menu_state_masterserver.h b/source/glest_game/menu/menu_state_masterserver.h index 2b4f5c1e5..48665073c 100644 --- a/source/glest_game/menu/menu_state_masterserver.h +++ b/source/glest_game/menu/menu_state_masterserver.h @@ -1,7 +1,7 @@ // ============================================================== // This file is part of Glest (www.glest.org) // -// Copyright (C) 2001-2005 Marti�o Figueroa +// Copyright (C) 2001-2005 Martiño Figueroa // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published diff --git a/source/glest_game/menu/menu_state_new_game.cpp b/source/glest_game/menu/menu_state_new_game.cpp index 3d709fdfa..448cb40d0 100644 --- a/source/glest_game/menu/menu_state_new_game.cpp +++ b/source/glest_game/menu/menu_state_new_game.cpp @@ -1,7 +1,7 @@ // ============================================================== // This file is part of Glest (www.glest.org) // -// Copyright (C) 2001-2005 Marti�o Figueroa +// Copyright (C) 2001-2005 Martiño Figueroa // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published @@ -17,6 +17,8 @@ #include "config.h" #include "menu_state_custom_game.h" #include "menu_state_scenario.h" +#include "menu_state_join_game.h" +#include "menu_state_masterserver.h" #include "menu_state_root.h" #include "metrics.h" #include "network_manager.h" @@ -38,17 +40,30 @@ MenuStateNewGame::MenuStateNewGame(Program *program, MainMenu *mainMenu): containerName = "NewGame"; Lang &lang= Lang::getInstance(); + int yPos=385; + buttonCustomGame.registerGraphicComponent(containerName,"buttonCustomGame"); - buttonCustomGame.init(425, 350, 150); + buttonCustomGame.init(425, yPos, 150); + yPos-=40; buttonScenario.registerGraphicComponent(containerName,"buttonScenario"); - buttonScenario.init(425, 310, 150); + buttonScenario.init(425, yPos, 150); + yPos-=40; + buttonMasterserverGame.registerGraphicComponent(containerName,"buttonMasterserverGame"); + buttonMasterserverGame.init(425, yPos, 150); + yPos-=40; + buttonJoinGame.registerGraphicComponent(containerName,"buttonJoinGame"); + buttonJoinGame.init(425, yPos, 150); + yPos-=40; buttonTutorial.registerGraphicComponent(containerName,"buttonTutorial"); - buttonTutorial.init(425, 270, 150); + buttonTutorial.init(425, yPos, 150); + yPos-=40; buttonReturn.registerGraphicComponent(containerName,"buttonReturn"); - buttonReturn.init(425, 230, 150); + buttonReturn.init(425, yPos, 150); buttonCustomGame.setText(lang.get("CustomGame")); buttonScenario.setText(lang.get("Scenario")); + buttonJoinGame.setText(lang.get("JoinGame")); + buttonMasterserverGame.setText(lang.get("JoinInternetGame")); buttonTutorial.setText(lang.get("Tutorial")); buttonReturn.setText(lang.get("Return")); @@ -69,6 +84,14 @@ void MenuStateNewGame::mouseClick(int x, int y, MouseButton mouseButton){ else if(buttonScenario.mouseClick(x, y)){ soundRenderer.playFx(coreData.getClickSoundB()); mainMenu->setState(new MenuStateScenario(program, mainMenu, Config::getInstance().getPathListForType(ptScenarios))); + } + else if(buttonJoinGame.mouseClick(x, y)){ + soundRenderer.playFx(coreData.getClickSoundB()); + mainMenu->setState(new MenuStateJoinGame(program, mainMenu)); + } + else if(buttonMasterserverGame.mouseClick(x, y)){ + soundRenderer.playFx(coreData.getClickSoundB()); + mainMenu->setState(new MenuStateMasterserver(program, mainMenu)); } else if(buttonTutorial.mouseClick(x, y)){ soundRenderer.playFx(coreData.getClickSoundB()); @@ -83,6 +106,8 @@ void MenuStateNewGame::mouseClick(int x, int y, MouseButton mouseButton){ void MenuStateNewGame::mouseMove(int x, int y, const MouseState *ms){ buttonCustomGame.mouseMove(x, y); buttonScenario.mouseMove(x, y); + buttonJoinGame.mouseMove(x, y); + buttonMasterserverGame.mouseMove(x, y); buttonTutorial.mouseMove(x, y); buttonReturn.mouseMove(x, y); } @@ -92,6 +117,8 @@ void MenuStateNewGame::render(){ renderer.renderButton(&buttonCustomGame); renderer.renderButton(&buttonScenario); + renderer.renderButton(&buttonJoinGame); + renderer.renderButton(&buttonMasterserverGame); renderer.renderButton(&buttonTutorial); renderer.renderButton(&buttonReturn); diff --git a/source/glest_game/menu/menu_state_new_game.h b/source/glest_game/menu/menu_state_new_game.h index b85394f53..a105b50ef 100644 --- a/source/glest_game/menu/menu_state_new_game.h +++ b/source/glest_game/menu/menu_state_new_game.h @@ -1,7 +1,7 @@ // ============================================================== // This file is part of Glest (www.glest.org) // -// Copyright (C) 2001-2005 Martio Figueroa +// Copyright (C) 2001-2005 Martiño Figueroa // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published @@ -25,6 +25,8 @@ class MenuStateNewGame: public MenuState{ private: GraphicButton buttonCustomGame; GraphicButton buttonScenario; + GraphicButton buttonJoinGame; + GraphicButton buttonMasterserverGame; GraphicButton buttonTutorial; GraphicButton buttonReturn; diff --git a/source/glest_game/menu/menu_state_root.cpp b/source/glest_game/menu/menu_state_root.cpp index 6c875567e..bdcfac988 100644 --- a/source/glest_game/menu/menu_state_root.cpp +++ b/source/glest_game/menu/menu_state_root.cpp @@ -1,7 +1,7 @@ // ============================================================== // This file is part of Glest (www.glest.org) // -// Copyright (C) 2001-2005 Marti�o Figueroa +// Copyright (C) 2001-2005 Martiño Figueroa // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published @@ -16,10 +16,8 @@ #include "core_data.h" #include "config.h" #include "menu_state_new_game.h" -#include "menu_state_join_game.h" #include "menu_state_options.h" #include "menu_state_about.h" -#include "menu_state_masterserver.h" #include "menu_state_mods.h" #include "metrics.h" #include "network_manager.h" @@ -56,18 +54,10 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): yPos-=55; buttonNewGame.registerGraphicComponent(containerName,"buttonNewGame"); buttonNewGame.init(425, yPos, 150); - yPos-=40; - buttonJoinGame.registerGraphicComponent(containerName,"buttonJoinGame"); - buttonJoinGame.init(425, yPos, 150); yPos-=40; - buttonMasterserverGame.registerGraphicComponent(containerName,"buttonMasterserverGame"); - buttonMasterserverGame.init(425, yPos, 150); - yPos-=40; - buttonMods.registerGraphicComponent(containerName,"buttonMods"); buttonMods.init(425, yPos, 150); yPos-=40; - buttonOptions.registerGraphicComponent(containerName,"buttonOptions"); buttonOptions.init(425, yPos, 150); yPos-=40; @@ -78,8 +68,6 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): buttonExit.init(425, yPos, 150); buttonNewGame.setText(lang.get("NewGame")); - buttonJoinGame.setText(lang.get("JoinGame")); - buttonMasterserverGame.setText(lang.get("JoinInternetGame")); buttonMods.setText(lang.get("Mods")); buttonOptions.setText(lang.get("Options")); buttonAbout.setText(lang.get("About")); @@ -101,14 +89,6 @@ void MenuStateRoot::mouseClick(int x, int y, MouseButton mouseButton){ if(buttonNewGame.mouseClick(x, y)){ soundRenderer.playFx(coreData.getClickSoundB()); mainMenu->setState(new MenuStateNewGame(program, mainMenu)); - } - else if(buttonJoinGame.mouseClick(x, y)){ - soundRenderer.playFx(coreData.getClickSoundB()); - mainMenu->setState(new MenuStateJoinGame(program, mainMenu)); - } - else if(buttonMasterserverGame.mouseClick(x, y)){ - soundRenderer.playFx(coreData.getClickSoundB()); - mainMenu->setState(new MenuStateMasterserver(program, mainMenu)); } else if(buttonMods.mouseClick(x, y)){ soundRenderer.playFx(coreData.getClickSoundB()); @@ -146,8 +126,6 @@ void MenuStateRoot::mouseClick(int x, int y, MouseButton mouseButton){ void MenuStateRoot::mouseMove(int x, int y, const MouseState *ms){ buttonNewGame.mouseMove(x, y); - buttonJoinGame.mouseMove(x, y); - buttonMasterserverGame.mouseMove(x, y); buttonMods.mouseMove(x, y); buttonOptions.mouseMove(x, y); buttonAbout.mouseMove(x, y); @@ -190,8 +168,6 @@ void MenuStateRoot::render() { currentX += extraLogo->getPixmap()->getW(); } renderer.renderButton(&buttonNewGame); - renderer.renderButton(&buttonJoinGame); - renderer.renderButton(&buttonMasterserverGame); renderer.renderButton(&buttonMods); renderer.renderButton(&buttonOptions); renderer.renderButton(&buttonAbout); diff --git a/source/glest_game/menu/menu_state_root.h b/source/glest_game/menu/menu_state_root.h index ec7404a90..573437658 100644 --- a/source/glest_game/menu/menu_state_root.h +++ b/source/glest_game/menu/menu_state_root.h @@ -1,7 +1,7 @@ // ============================================================== // This file is part of Glest (www.glest.org) // -// Copyright (C) 2001-2005 Marti�o Figueroa +// Copyright (C) 2001-2005 Martiño Figueroa // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published @@ -26,8 +26,6 @@ class GraphicMessageBox; class MenuStateRoot: public MenuState{ private: GraphicButton buttonNewGame; - GraphicButton buttonJoinGame; - GraphicButton buttonMasterserverGame; GraphicButton buttonMods; GraphicButton buttonOptions; GraphicButton buttonAbout;