[Orxonox-commit 226] r2071 - media/gui/scripts

bknecht at orxonox.net bknecht at orxonox.net
Thu Apr 2 17:05:25 CEST 2009


Author: bknecht
Date: 2009-04-02 17:05:25 +0200 (Thu, 02 Apr 2009)
New Revision: 2071

Modified:
   media/gui/scripts/loadGUI_2.lua
Log:
added some debug-output to fix stuff I ran into with LUa on Tardis. Not solved unfortunately. Game crashes when using the showingamegui command

Modified: media/gui/scripts/loadGUI_2.lua
===================================================================
--- media/gui/scripts/loadGUI_2.lua	2009-04-02 14:09:49 UTC (rev 2070)
+++ media/gui/scripts/loadGUI_2.lua	2009-04-02 15:05:25 UTC (rev 2071)
@@ -24,7 +24,9 @@
 
 -- function which returns a GUI by name
 loadedGUIs.getGUIbyName = function (str)
+    print("number of GUIs loaded: " .. #loadedGUIs)
     for i = 1, #loadedGUIs, 1 do
+        print("Checking GUI " .. loadedGUIs[i].filename)
         if str == loadedGUIs[i].filename then
             return loadedGUIs[i]
         end
@@ -36,6 +38,8 @@
 -- be sure to set the global variable "filename" before calling this function
 function loadGUI(filename)
     -- check if it already exists
+    print("about to load " .. filename)
+    print("search for GUI " .. filename)
     newlyLoaded = loadedGUIs:getGUIbyName(filename)
     if newlyLoaded == nil then
         dofile(datapath .. "gui/scripts/" .. filename .. ".lua")
@@ -56,15 +60,18 @@
 -- shows the specified and loads it if not loaded already
 -- be sure to set the global variable "filename" before calling this function
 function showGUI(filename)
+    print("about to show " .. filename)
     if current == nil or current.filename ~= filename then
+        print("current not set")
+        print("search for GUI " .. filename)
         current = loadedGUIs.getGUIbyName(filename)
         if current == nil then
             current = loadGUI(filename)
         end
         system:setGUISheet(current)
     end
+    print("Showing " .. filename)
     current:show()
-    cursor:show()
     showing = true
 end
 
@@ -81,7 +88,22 @@
     return showing
 end
 
-function hideGUI()
-    current:hide()
-    showing = false
+function hideCursor()
+    cursor:hide()
 end
+
+function showCursor()
+    cursor:show()
+end
+
+function hideGUI(filename)
+    print("about to hide " .. filename)
+    print("search for GUI " .. filename)
+    current = loadedGUIs.getGUIbyName(filename)
+    print("current is: " .. current)
+    if current ~= nil then
+        print("Hiding " .. filename)
+        current:hide()
+        showing = false
+    end
+end




More information about the Orxonox-commit mailing list