menu structure changed

This commit is contained in:
Titus Tscharntke
2011-04-10 20:03:38 +00:00
parent 0a2ffde50f
commit 842f1dac69
7 changed files with 42 additions and 39 deletions

View File

@@ -16,7 +16,7 @@
#include "sound_renderer.h" #include "sound_renderer.h"
#include "core_data.h" #include "core_data.h"
#include "config.h" #include "config.h"
#include "menu_state_root.h" #include "menu_state_new_game.h"
#include "metrics.h" #include "metrics.h"
#include "network_manager.h" #include "network_manager.h"
#include "network_message.h" #include "network_message.h"
@@ -241,7 +241,7 @@ void MenuStateJoinGame::mouseClick(int x, int y, MouseButton mouseButton) {
clientInterface->close(); clientInterface->close();
} }
abortAutoFind = true; abortAutoFind = true;
mainMenu->setState(new MenuStateRoot(program, mainMenu)); mainMenu->setState(new MenuStateNewGame(program, mainMenu));
} }
//connect //connect

View File

@@ -18,7 +18,7 @@
#include "config.h" #include "config.h"
#include "menu_state_connected_game.h" #include "menu_state_connected_game.h"
#include "menu_state_custom_game.h" #include "menu_state_custom_game.h"
#include "menu_state_root.h" #include "menu_state_new_game.h"
#include "metrics.h" #include "metrics.h"
#include "network_manager.h" #include "network_manager.h"
#include "network_message.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__); 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__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest (www.glest.org) // This file is part of Glest (www.glest.org)
// //
// Copyright (C) 2001-2005 Marti<74>o Figueroa // Copyright (C) 2001-2005 Marti<74>o Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest (www.glest.org) // This file is part of Glest (www.glest.org)
// //
// Copyright (C) 2001-2005 Marti<74>o Figueroa // Copyright (C) 2001-2005 Marti<74>o Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
@@ -17,6 +17,8 @@
#include "config.h" #include "config.h"
#include "menu_state_custom_game.h" #include "menu_state_custom_game.h"
#include "menu_state_scenario.h" #include "menu_state_scenario.h"
#include "menu_state_join_game.h"
#include "menu_state_masterserver.h"
#include "menu_state_root.h" #include "menu_state_root.h"
#include "metrics.h" #include "metrics.h"
#include "network_manager.h" #include "network_manager.h"
@@ -38,17 +40,30 @@ MenuStateNewGame::MenuStateNewGame(Program *program, MainMenu *mainMenu):
containerName = "NewGame"; containerName = "NewGame";
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
int yPos=385;
buttonCustomGame.registerGraphicComponent(containerName,"buttonCustomGame"); buttonCustomGame.registerGraphicComponent(containerName,"buttonCustomGame");
buttonCustomGame.init(425, 350, 150); buttonCustomGame.init(425, yPos, 150);
yPos-=40;
buttonScenario.registerGraphicComponent(containerName,"buttonScenario"); 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.registerGraphicComponent(containerName,"buttonTutorial");
buttonTutorial.init(425, 270, 150); buttonTutorial.init(425, yPos, 150);
yPos-=40;
buttonReturn.registerGraphicComponent(containerName,"buttonReturn"); buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
buttonReturn.init(425, 230, 150); buttonReturn.init(425, yPos, 150);
buttonCustomGame.setText(lang.get("CustomGame")); buttonCustomGame.setText(lang.get("CustomGame"));
buttonScenario.setText(lang.get("Scenario")); buttonScenario.setText(lang.get("Scenario"));
buttonJoinGame.setText(lang.get("JoinGame"));
buttonMasterserverGame.setText(lang.get("JoinInternetGame"));
buttonTutorial.setText(lang.get("Tutorial")); buttonTutorial.setText(lang.get("Tutorial"));
buttonReturn.setText(lang.get("Return")); buttonReturn.setText(lang.get("Return"));
@@ -69,6 +84,14 @@ void MenuStateNewGame::mouseClick(int x, int y, MouseButton mouseButton){
else if(buttonScenario.mouseClick(x, y)){ else if(buttonScenario.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundB()); soundRenderer.playFx(coreData.getClickSoundB());
mainMenu->setState(new MenuStateScenario(program, mainMenu, Config::getInstance().getPathListForType(ptScenarios))); 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)){ else if(buttonTutorial.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundB()); 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){ void MenuStateNewGame::mouseMove(int x, int y, const MouseState *ms){
buttonCustomGame.mouseMove(x, y); buttonCustomGame.mouseMove(x, y);
buttonScenario.mouseMove(x, y); buttonScenario.mouseMove(x, y);
buttonJoinGame.mouseMove(x, y);
buttonMasterserverGame.mouseMove(x, y);
buttonTutorial.mouseMove(x, y); buttonTutorial.mouseMove(x, y);
buttonReturn.mouseMove(x, y); buttonReturn.mouseMove(x, y);
} }
@@ -92,6 +117,8 @@ void MenuStateNewGame::render(){
renderer.renderButton(&buttonCustomGame); renderer.renderButton(&buttonCustomGame);
renderer.renderButton(&buttonScenario); renderer.renderButton(&buttonScenario);
renderer.renderButton(&buttonJoinGame);
renderer.renderButton(&buttonMasterserverGame);
renderer.renderButton(&buttonTutorial); renderer.renderButton(&buttonTutorial);
renderer.renderButton(&buttonReturn); renderer.renderButton(&buttonReturn);

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest (www.glest.org) // This file is part of Glest (www.glest.org)
// //
// Copyright (C) 2001-2005 Martio Figueroa // Copyright (C) 2001-2005 Marti<EFBFBD>o Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
@@ -25,6 +25,8 @@ class MenuStateNewGame: public MenuState{
private: private:
GraphicButton buttonCustomGame; GraphicButton buttonCustomGame;
GraphicButton buttonScenario; GraphicButton buttonScenario;
GraphicButton buttonJoinGame;
GraphicButton buttonMasterserverGame;
GraphicButton buttonTutorial; GraphicButton buttonTutorial;
GraphicButton buttonReturn; GraphicButton buttonReturn;

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest (www.glest.org) // This file is part of Glest (www.glest.org)
// //
// Copyright (C) 2001-2005 Marti<74>o Figueroa // Copyright (C) 2001-2005 Marti<74>o Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
@@ -16,10 +16,8 @@
#include "core_data.h" #include "core_data.h"
#include "config.h" #include "config.h"
#include "menu_state_new_game.h" #include "menu_state_new_game.h"
#include "menu_state_join_game.h"
#include "menu_state_options.h" #include "menu_state_options.h"
#include "menu_state_about.h" #include "menu_state_about.h"
#include "menu_state_masterserver.h"
#include "menu_state_mods.h" #include "menu_state_mods.h"
#include "metrics.h" #include "metrics.h"
#include "network_manager.h" #include "network_manager.h"
@@ -57,17 +55,9 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
buttonNewGame.registerGraphicComponent(containerName,"buttonNewGame"); buttonNewGame.registerGraphicComponent(containerName,"buttonNewGame");
buttonNewGame.init(425, yPos, 150); buttonNewGame.init(425, yPos, 150);
yPos-=40; 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.registerGraphicComponent(containerName,"buttonMods");
buttonMods.init(425, yPos, 150); buttonMods.init(425, yPos, 150);
yPos-=40; yPos-=40;
buttonOptions.registerGraphicComponent(containerName,"buttonOptions"); buttonOptions.registerGraphicComponent(containerName,"buttonOptions");
buttonOptions.init(425, yPos, 150); buttonOptions.init(425, yPos, 150);
yPos-=40; yPos-=40;
@@ -78,8 +68,6 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
buttonExit.init(425, yPos, 150); buttonExit.init(425, yPos, 150);
buttonNewGame.setText(lang.get("NewGame")); buttonNewGame.setText(lang.get("NewGame"));
buttonJoinGame.setText(lang.get("JoinGame"));
buttonMasterserverGame.setText(lang.get("JoinInternetGame"));
buttonMods.setText(lang.get("Mods")); buttonMods.setText(lang.get("Mods"));
buttonOptions.setText(lang.get("Options")); buttonOptions.setText(lang.get("Options"));
buttonAbout.setText(lang.get("About")); buttonAbout.setText(lang.get("About"));
@@ -101,14 +89,6 @@ void MenuStateRoot::mouseClick(int x, int y, MouseButton mouseButton){
if(buttonNewGame.mouseClick(x, y)){ if(buttonNewGame.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundB()); soundRenderer.playFx(coreData.getClickSoundB());
mainMenu->setState(new MenuStateNewGame(program, mainMenu)); 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)){ else if(buttonMods.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundB()); 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){ void MenuStateRoot::mouseMove(int x, int y, const MouseState *ms){
buttonNewGame.mouseMove(x, y); buttonNewGame.mouseMove(x, y);
buttonJoinGame.mouseMove(x, y);
buttonMasterserverGame.mouseMove(x, y);
buttonMods.mouseMove(x, y); buttonMods.mouseMove(x, y);
buttonOptions.mouseMove(x, y); buttonOptions.mouseMove(x, y);
buttonAbout.mouseMove(x, y); buttonAbout.mouseMove(x, y);
@@ -190,8 +168,6 @@ void MenuStateRoot::render() {
currentX += extraLogo->getPixmap()->getW(); currentX += extraLogo->getPixmap()->getW();
} }
renderer.renderButton(&buttonNewGame); renderer.renderButton(&buttonNewGame);
renderer.renderButton(&buttonJoinGame);
renderer.renderButton(&buttonMasterserverGame);
renderer.renderButton(&buttonMods); renderer.renderButton(&buttonMods);
renderer.renderButton(&buttonOptions); renderer.renderButton(&buttonOptions);
renderer.renderButton(&buttonAbout); renderer.renderButton(&buttonAbout);

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest (www.glest.org) // This file is part of Glest (www.glest.org)
// //
// Copyright (C) 2001-2005 Marti<74>o Figueroa // Copyright (C) 2001-2005 Marti<74>o Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
@@ -26,8 +26,6 @@ class GraphicMessageBox;
class MenuStateRoot: public MenuState{ class MenuStateRoot: public MenuState{
private: private:
GraphicButton buttonNewGame; GraphicButton buttonNewGame;
GraphicButton buttonJoinGame;
GraphicButton buttonMasterserverGame;
GraphicButton buttonMods; GraphicButton buttonMods;
GraphicButton buttonOptions; GraphicButton buttonOptions;
GraphicButton buttonAbout; GraphicButton buttonAbout;