[Orxonox-commit 115] r2039 - in media/gui: layouts scripts

bknecht at orxonox.net bknecht at orxonox.net
Sat Mar 21 01:10:54 CET 2009


Author: bknecht
Date: 2009-03-21 00:10:54 +0000 (Sat, 21 Mar 2009)
New Revision: 2039

Added:
   media/gui/layouts/MainMenu.layout
Modified:
   media/gui/scripts/loadGUI.lua
Log:
Removed layout information to actual .layout file and leaving functions and script stuff in the lua-file. There is still some work to do to properly load layouts and call the correct functions, but it's more cleaned up now, but also more spread of corse.

Added: media/gui/layouts/MainMenu.layout
===================================================================
--- media/gui/layouts/MainMenu.layout	                        (rev 0)
+++ media/gui/layouts/MainMenu.layout	2009-03-21 00:10:54 UTC (rev 2039)
@@ -0,0 +1,41 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="DefaultGUISheet" Name="orxonox/RootSheet">
+        <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Standalone"/>
+            <Event Name="Clicked" Function="button_standalone_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Dedicated"/>
+            <Event Name="Clicked" Function="button_dedicated_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/ServerButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.452,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Server"/>
+            <Event Name="Clicked" Function="button_server_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/ClientButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Client"/>
+            <Event Name="Clicked" Function="button_client_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/QuitButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Quit"/>
+            <Event Name="Clicked" Function="button_quit_clicked"/>
+        </Window>
+        <Window Type="TaharezLook/Button" Name="orxonox/TestButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.604,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Hide"/>
+            <Event Name="Clicked" Function="toggleGUI"/>
+        </Window>
+    </Window>
+</GUILayout>

Modified: media/gui/scripts/loadGUI.lua
===================================================================
--- media/gui/scripts/loadGUI.lua	2009-03-20 12:17:20 UTC (rev 2038)
+++ media/gui/scripts/loadGUI.lua	2009-03-21 00:10:54 UTC (rev 2039)
@@ -7,61 +7,16 @@
 system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
 system:setDefaultFont("BlueHighway-12")
 
+
+local mainmenu =  winMgr:loadWindowLayout("MainMenu.layout")
 
-local rootSheet = winMgr:createWindow("DefaultGUISheet", "orxonox/Sheet")
-
-local leftOffset = 0.11
-local topOffset  = 0.3
-local distance   = 0.076
-local index      = 0
-
-local standalone = winMgr:createWindow("TaharezLook/Button", "orxonox/StandaloneButton")
-standalone:setText("Standalone")
-standalone:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
-standalone:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
-standalone:subscribeEvent("Clicked","button_standalone_clicked")
-index = index + 1
-
-local dedicated = winMgr:createWindow("TaharezLook/Button", "orxonox/DedicatedButton")
-dedicated:setText("Dedicated")
-dedicated:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
-dedicated:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
-dedicated:subscribeEvent("Clicked","button_dedicated_clicked")
-index = index + 1
-
-local server = winMgr:createWindow("TaharezLook/Button", "orxonox/ServerButton")
-server:setText("Server")
-server:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
-server:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
-server:subscribeEvent("Clicked","button_server_clicked")
-index = index + 1
-
-local client = winMgr:createWindow("TaharezLook/Button", "orxonox/ClientButton")
-client:setText("Client")
-client:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
-client:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
-client:subscribeEvent("Clicked","button_client_clicked")
-index = index + 1
-
-local quit = winMgr:createWindow("TaharezLook/Button", "orxonox/QuitButton")
-quit:setText("Quit")
-quit:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
-quit:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
-quit:subscribeEvent("Clicked","button_quit_clicked")
-index = index + 1
-
 local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "main_menu_1.jpg")
 local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background")
 background:setProperty("FrameEnabled", "set: true")
 background:setProperty("BackgroundEnabled", "set: false")
 background:setProperty("Image", "set: GUI/Background image:full_image")
 
-rootSheet:addChildWindow(quit)
-rootSheet:addChildWindow(standalone)
-rootSheet:addChildWindow(server)
-rootSheet:addChildWindow(dedicated)
-rootSheet:addChildWindow(client)
-background:addChildWindow(rootSheet)
+background:addChildWindow(mainmenu)
 
 
 function button_quit_clicked(e)
@@ -89,18 +44,33 @@
   hideGUI()
 end
 
-showBackground = false
+showBackground = true
 
 function showMainMenu()
   if showBackground == true then
     system:setGUISheet(background)
-  else
-    system:setGUISheet(rootSheet)
+  else
+    orxonox.GUIManager:getInstance():testOutput("set new Menu")
+    system:setGUISheet(mainmenu)
   end
   return 0;
+end
+
+showing = true
+
+function toggleGUI()
+    if showing == true then
+        mainmenu:hide()
+        showing = false
+        orxonox.GUIManager:getInstance():testOutput("hiding Menu")
+    else
+        mainmenu:show()
+        showing = true
+        orxonox.GUIManager:getInstance():testOutput("showing Menu")
+    end
 end
 
 function hideGUI()
   --system:setGUISheet(nil)
-  orxonox.GUIManager:getInstance():hideGUI()
+  --orxonox.GUIManager:getInstance():hideGUI()
 end




More information about the Orxonox-commit mailing list