From 83dbaf788657a8a164949b30401e7f76881794be Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 15 May 2010 19:51:58 +0000 Subject: [PATCH] added hotkey of ? as a way to toggle on/off the debug UI display --- source/glest_game/game/game.cpp | 11 +++++------ source/glest_game/gui/gui.cpp | 4 ++++ source/glest_game/gui/gui.h | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 10dc68618..e966b5af7 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -1011,14 +1011,13 @@ void Game::render2d(){ } } - if(config.getBool("DebugMode")){ - renderer.renderText( - str, coreData.getMenuFontNormal(), - Vec3f(1.0f), 10, 500, false); + if(config.getBool("DebugMode") && gui.getShowDebugUI() == true) { + renderer.renderText(str, coreData.getMenuFontNormal(), + Vec3f(1.0f), 10, 500, false); } //network status - if(renderNetworkStatus){ + if(renderNetworkStatus) { renderer.renderText( NetworkManager::getInstance().getGameNetworkInterface()->getNetworkStatus(), coreData.getMenuFontNormal(), @@ -1026,7 +1025,7 @@ void Game::render2d(){ } //resource info - if(!config.getBool("PhotoMode")){ + if(!config.getBool("PhotoMode")) { renderer.renderResourceStatus(); renderer.renderConsole(&console,showFullConsole); } diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index b54ddf7de..91a4040a9 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -118,6 +118,7 @@ void Gui::init(Game *game){ this->console= game->getConsole(); this->world= game->getWorld(); selection.init(this, world->getThisFactionIndex()); + this->showDebugUI = false; } void Gui::end(){ @@ -338,6 +339,9 @@ void Gui::hotKey(char key){ else if(key=='B'){ selectInterestingUnit(iutBuiltBuilding); } + else if(key=='?') { + this->showDebugUI = !this->showDebugUI; + } else if(key=='R'){ // Here the user triggers a unit rotation while placing a unit if(allowRotateUnits == true && isPlacingBuilding()) { diff --git a/source/glest_game/gui/gui.h b/source/glest_game/gui/gui.h index 1d44a59ab..f21de80c6 100644 --- a/source/glest_game/gui/gui.h +++ b/source/glest_game/gui/gui.h @@ -133,6 +133,8 @@ private: CardinalDir selectedBuildingFacing; bool allowRotateUnits; + bool showDebugUI; + public: Gui(); void init(Game *game); @@ -177,6 +179,8 @@ public: void switchToNextDisplayColor(); void onSelectionChanged(); + bool getShowDebugUI() { return showDebugUI; } + private: //orders