From 03d706db110f2533d09fbf0480d09b74bcd5c0c4 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Thu, 7 Apr 2011 23:30:27 +0000 Subject: [PATCH] additional data/core/menu/credits.txt file can be given for about screen --- source/glest_game/menu/menu_state_about.cpp | 111 ++++++++++++++------ source/glest_game/menu/menu_state_about.h | 3 + 2 files changed, 82 insertions(+), 32 deletions(-) diff --git a/source/glest_game/menu/menu_state_about.cpp b/source/glest_game/menu/menu_state_about.cpp index df52b4cfe..54a351aad 100644 --- a/source/glest_game/menu/menu_state_about.cpp +++ b/source/glest_game/menu/menu_state_about.cpp @@ -17,43 +17,69 @@ #include "core_data.h" #include "config.h" #include "menu_state_options.h" +#include #include "leak_dumper.h" -namespace Glest{ namespace Game{ +using namespace std; + +namespace Glest { +namespace Game { // ===================================================== // class MenuStateAbout // ===================================================== MenuStateAbout::MenuStateAbout(Program *program, MainMenu *mainMenu) : - MenuState(program, mainMenu, "about") { + MenuState(program, mainMenu, "about"){ - containerName = "About"; + containerName= "About"; Lang &lang= Lang::getInstance(); - + + string additionalCredits= loadAdditionalCredits(); + //init - buttonReturn.registerGraphicComponent(containerName,"buttonReturn"); + buttonReturn.registerGraphicComponent(containerName, "buttonReturn"); buttonReturn.init(460, 100, 125); buttonReturn.setText(lang.get("Return")); - - for(int i= 0; isetState(new MenuStateRoot(program, mainMenu)); - } + } } @@ -89,29 +133,32 @@ void MenuStateAbout::mouseMove(int x, int y, const MouseState *ms){ void MenuStateAbout::render(){ Renderer &renderer= Renderer::getInstance(); + renderer.renderLabel(&labelAdditionalCredits); renderer.renderButton(&buttonReturn); - for(int i= 0; irenderProgramMsgBox(); + if(program != NULL) + program->renderProgramMsgBox(); } -void MenuStateAbout::keyDown(char key) { - Config &configKeys = Config::getInstance(std::pair(cfgMainKeys,cfgUserKeys)); - if(key == configKeys.getCharKey("SaveGUILayout")) { - bool saved = GraphicComponent::saveAllCustomProperties(containerName); +void MenuStateAbout::keyDown(char key){ + Config &configKeys= Config::getInstance(std::pair(cfgMainKeys, cfgUserKeys)); + if(key == configKeys.getCharKey("SaveGUILayout")){ + bool saved= GraphicComponent::saveAllCustomProperties(containerName); //Lang &lang= Lang::getInstance(); //console.addLine(lang.get("GUILayoutSaved") + " [" + (saved ? lang.get("Yes") : lang.get("No"))+ "]"); } } -}}//end namespace +} +}//end namespace diff --git a/source/glest_game/menu/menu_state_about.h b/source/glest_game/menu/menu_state_about.h index 6ef70f7f2..a1e10ea30 100644 --- a/source/glest_game/menu/menu_state_about.h +++ b/source/glest_game/menu/menu_state_about.h @@ -29,11 +29,14 @@ public: private: GraphicButton buttonReturn; + GraphicLabel labelAdditionalCredits; GraphicLabel labelAbout1[aboutStringCount1]; GraphicLabel labelAbout2[aboutStringCount2]; GraphicLabel labelTeammateName[teammateCount]; GraphicLabel labelTeammateRole[teammateCount]; + string loadAdditionalCredits(); + public: MenuStateAbout(Program *program, MainMenu *mainMenu);