From ca75809f2d9f64cbf1472e978821f716516a2fd7 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Thu, 9 Jun 2011 22:54:45 +0000 Subject: [PATCH] switch in options to show HUD or not ( if available ) --- source/glest_game/game/game.cpp | 6 +++-- source/glest_game/game/game.h | 1 + source/glest_game/menu/menu_state_options.cpp | 23 ++++++++++++------- source/glest_game/menu/menu_state_options.h | 4 ++++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 1b0be695..4ec48470 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -75,6 +75,7 @@ Game::Game(Program *program, const GameSettings *gameSettings): this->gameSettings= *gameSettings; scrollSpeed = Config::getInstance().getFloat("UiScrollSpeed","1.5"); photoModeEnabled = Config::getInstance().getBool("PhotoMode","false"); + visibleHUD = Config::getInstance().getBool("VisibleHud","true"); //MIN_RENDER_FPS_ALLOWED = Config::getInstance().getInt("MIN_RENDER_FPS_ALLOWED",intToStr(MIN_RENDER_FPS_ALLOWED).c_str()); mouseX=0; @@ -1885,8 +1886,9 @@ void Game::render2d(){ renderer.reset2d(); //HUD - renderer.renderHud(); - + if(visibleHUD == true) { + renderer.renderHud(); + } //display renderer.renderDisplay(); diff --git a/source/glest_game/game/game.h b/source/glest_game/game/game.h index d0c6d958..a4c915c9 100644 --- a/source/glest_game/game/game.h +++ b/source/glest_game/game/game.h @@ -115,6 +115,7 @@ private: int renderFpsAvgTest; bool photoModeEnabled; + bool visibleHUD; Program *program; bool gameStarted; diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index 5543f3e1..cc90ab90 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -267,6 +267,15 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): checkBoxDisableScreenshotConsoleText.setValue(!config.getBool("DisableScreenshotConsoleText","false")); currentLine-=30; + labelVisibleHud.registerGraphicComponent(containerName,"lavelVisibleHud"); + labelVisibleHud.init(currentLabelStart ,currentLine); + labelVisibleHud.setText(lang.get("VisibleHUD")); + + checkBoxVisibleHud.registerGraphicComponent(containerName,"checkBoxVisibleHud"); + checkBoxVisibleHud.init(currentColumnStart ,currentLine ); + checkBoxVisibleHud.setValue(config.getBool("VisibleHud","true")); + currentLine-=30; + // end ////////////////////////////////////////////////////////////////// @@ -615,8 +624,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){ listBoxScreenShotType.mouseClick(x, y); - labelDisableScreenshotConsoleText.mouseClick(x, y); checkBoxDisableScreenshotConsoleText.mouseClick(x, y); + checkBoxVisibleHud.mouseClick(x, y); } } @@ -646,21 +655,15 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){ checkBoxFullscreenWindowed.mouseMove(x, y); listFontSizeAdjustment.mouseMove(x, y); listBoxPublishServerExternalPort.mouseMove(x, y); - checkBoxEnableFTP.mouseMove(x, y); checkBoxEnableFTPServer.mouseMove(x, y); - checkBoxEnableFTPServerInternetTilesetXfer.mouseMove(x, y); checkBoxEnableFTPServerInternetTechtreeXfer.mouseMove(x, y); - checkBoxEnablePrivacy.mouseMove(x, y); - checkBoxEnableTextureCompression.mouseMove(x, y); - listBoxScreenShotType.mouseMove(x, y); - - labelDisableScreenshotConsoleText.mouseMove(x, y); checkBoxDisableScreenshotConsoleText.mouseMove(x, y); + checkBoxVisibleHud.mouseMove(x, y); } bool MenuStateOptions::isInSpecialKeyCaptureEvent() { @@ -791,6 +794,9 @@ void MenuStateOptions::render(){ renderer.renderLabel(&labelDisableScreenshotConsoleText); renderer.renderCheckBox(&checkBoxDisableScreenshotConsoleText); + + renderer.renderLabel(&labelVisibleHud); + renderer.renderCheckBox(&checkBoxVisibleHud); } renderer.renderConsole(&console,false,true); @@ -841,6 +847,7 @@ void MenuStateOptions::saveConfig(){ config.setString("ScreenShotFileType", listBoxScreenShotType.getSelectedItem()); config.setBool("DisableScreenshotConsoleText", !checkBoxDisableScreenshotConsoleText.getValue()); + config.setBool("VisibleHud", checkBoxVisibleHud.getValue()); string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight"); string selectedResolution=listBoxScreenModes.getSelectedItem(); diff --git a/source/glest_game/menu/menu_state_options.h b/source/glest_game/menu/menu_state_options.h index 9dc779b9..3d0ab787 100644 --- a/source/glest_game/menu/menu_state_options.h +++ b/source/glest_game/menu/menu_state_options.h @@ -114,6 +114,10 @@ private: GraphicLabel labelDisableScreenshotConsoleText; GraphicCheckBox checkBoxDisableScreenshotConsoleText; + GraphicLabel labelVisibleHud; + GraphicCheckBox checkBoxVisibleHud; + + public: MenuStateOptions(Program *program, MainMenu *mainMenu);