[Orxonox-commit 2949] r7649 - in code/branches/menu: data/gui/scripts src/orxonox/overlays

dafrick at orxonox.net dafrick at orxonox.net
Wed Nov 17 15:56:50 CET 2010


Author: dafrick
Date: 2010-11-17 15:56:50 +0100 (Wed, 17 Nov 2010)
New Revision: 7649

Modified:
   code/branches/menu/data/gui/scripts/SheetManager.lua
   code/branches/menu/src/orxonox/overlays/InGameConsole.cc
Log:
Restoring proper ESC functionality for InGameConsole.


Modified: code/branches/menu/data/gui/scripts/SheetManager.lua
===================================================================
--- code/branches/menu/data/gui/scripts/SheetManager.lua	2010-11-13 22:55:23 UTC (rev 7648)
+++ code/branches/menu/data/gui/scripts/SheetManager.lua	2010-11-17 14:56:50 UTC (rev 7649)
@@ -4,6 +4,7 @@
 local loadedSheets = {}
 local activeMenuSheets = {size = 0, topSheetTuple = nil}
 local menuSheetsRoot = guiMgr:getMenuRootWindow()
+local bInGameConsoleClosed = false
 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
 
 -----------------------
@@ -200,6 +201,12 @@
 function keyESC()
     -- HUGE, very HUGE hacks!
 
+    -- If the InGameConsole is active, ignore the ESC command.
+    if bInGameConsoleClosed == true then
+        bInGameConsoleClosed = falses
+        return
+    end
+
     -- Count the number of sheets that don't need input till the first that does.
     local counter = noInputSheetCounter()
 
@@ -234,6 +241,10 @@
     return counter
 end
 
+function inGameConsoleClosed()
+    bInGameConsoleClosed = not bInGameConsoleClosed;
+end
+
 ----------------------
 --- Initialisation ---
 ----------------------

Modified: code/branches/menu/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/branches/menu/src/orxonox/overlays/InGameConsole.cc	2010-11-13 22:55:23 UTC (rev 7648)
+++ code/branches/menu/src/orxonox/overlays/InGameConsole.cc	2010-11-17 14:56:50 UTC (rev 7649)
@@ -48,9 +48,11 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
 #include "core/command/ConsoleCommand.h"
+#include "core/GUIManager.h"
 #include "core/input/InputManager.h"
 #include "core/input/InputState.h"
 #include "core/input/InputBuffer.h"
+#include "core/LuaState.h"
 
 namespace orxonox
 {
@@ -494,7 +496,7 @@
                     output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_);
                 }
                 else
-                  this->inputWindowStart_ = 0;
+                    this->inputWindowStart_ = 0;
                 this->displayedText_ = output;
                 this->consoleOverlayTextAreas_[index]->setCaption(multi_cast<Ogre::DisplayString>(output));
             }
@@ -531,6 +533,7 @@
         if (this->bActive_)
         {
             this->bActive_ = false;
+            GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()"); // Notify the SheetManager in lua, that the console has been closed.
             InputManager::getInstance().leaveState("console");
             this->shell_->unregisterListener(this);
 
@@ -607,6 +610,8 @@
     */
     /*static*/ void InGameConsole::closeConsole()
     {
+        GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()");  // Notify the SheetManager in lua, that the console has been closed, but not by ESC.
         InGameConsole::getInstance().deactivate();
     }
+
 }




More information about the Orxonox-commit mailing list