[Orxonox-commit 173] r2057 - in media/gui: layouts scripts

rgrieder at orxonox.net rgrieder at orxonox.net
Wed Mar 25 23:48:19 CET 2009


Author: rgrieder
Date: 2009-03-25 22:48:19 +0000 (Wed, 25 Mar 2009)
New Revision: 2057

Added:
   media/gui/layouts/InGameTest.layout
   media/gui/scripts/inGameTest.lua
Modified:
   media/gui/scripts/loadGUI_2.lua
Log:
Added inGameGUI test sheet.
Also removed workaround for the filename. Found another way by using executeString() in CEGUILua.

Added: media/gui/layouts/InGameTest.layout
===================================================================
--- media/gui/layouts/InGameTest.layout	                        (rev 0)
+++ media/gui/layouts/InGameTest.layout	2009-03-25 22:48:19 UTC (rev 2057)
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="DefaultGUISheet" Name="orxonox/TestWindow">
+    <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
+
+        <Window Type="TaharezLook/Button" Name="orxonox/TestButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="NoFunction"/>
+        </Window>
+
+    </Window>
+</GUILayout>

Added: media/gui/scripts/inGameTest.lua
===================================================================
--- media/gui/scripts/inGameTest.lua	                        (rev 0)
+++ media/gui/scripts/inGameTest.lua	2009-03-25 22:48:19 UTC (rev 2057)
@@ -0,0 +1 @@
+layoutPath = "InGameTest.layout"

Modified: media/gui/scripts/loadGUI_2.lua
===================================================================
--- media/gui/scripts/loadGUI_2.lua	2009-03-25 22:32:47 UTC (rev 2056)
+++ media/gui/scripts/loadGUI_2.lua	2009-03-25 22:48:19 UTC (rev 2057)
@@ -14,8 +14,7 @@
 local current = nil
 local loadedGUIs = {}
 local showing
--- we cannot directly call functions with parameters and so need this as a global variable, which sucks of course
-filename = ""
+
 datapath = "" -- points to media-folder (set after loading the script)
 
 -- function to add a reference to list of reference of loaded GUIs
@@ -35,11 +34,11 @@
 
 -- loads the GUI with the specified filename
 -- be sure to set the global variable "filename" before calling this function
-function loadGUI()
+function loadGUI(filename)
     -- check if it already exists
     newlyLoaded = loadedGUIs:getGUIbyName(filename)
     if newlyLoaded == nil then
-        dofile(datapath .. "gui/scripts/" .. filename)
+        dofile(datapath .. "gui/scripts/" .. filename .. ".lua")
         newlyLoaded = winMgr:loadWindowLayout(layoutPath)
         newlyLoaded.filename = filename
         loadedGUIs:addGUI(newlyLoaded)
@@ -56,7 +55,7 @@
 
 -- shows the specified and loads it if not loaded already
 -- be sure to set the global variable "filename" before calling this function
-function showGUI()
+function showGUI(filename)
     if current == nil or current.filename ~= filename then
         current = loadedGUIs.getGUIbyName(filename)
         if current == nil then




More information about the Orxonox-commit mailing list