Index: data/media/gui/scripts/loadGUI.lua
===================================================================
--- data/media/gui/scripts/loadGUI.lua	(revision 5427)
+++ data/media/gui/scripts/loadGUI.lua	(revision 5428)
@@ -3,86 +3,104 @@
 local logger = CEGUI.Logger:getSingleton()
 local system = CEGUI.System:getSingleton()
-local cursor = CEGUI.MouseCursor:getSingleton()
 
 schemeMgr:loadScheme("TaharezLookSkin.scheme")
--- load scheme with our own images
-schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
-
 system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
 system:setDefaultFont("BlueHighway-12")
 
-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
-loadedGUIs.addGUI = function (gui)
-    loadedGUIs[#loadedGUIs+1] = gui
+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)
+
+
+function button_quit_clicked(e)
+  hideGUI()
+  orxonox.CommandExecutor:execute("exit")
 end
 
--- function which returns a GUI by name
-loadedGUIs.getGUIbyName = function (str)
-    for i = 1, #loadedGUIs, 1 do
-        if str == loadedGUIs[i].filename then
-            return loadedGUIs[i]
-        end
-    end
-    return nil
+function button_standalone_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState standalone")
+  hideGUI()
 end
 
--- loads the GUI with the specified filename
--- be sure to set the global variable "filename" before calling this function
-function loadGUI()
-    -- check if it already exists
-    newlyLoaded = loadedGUIs:getGUIbyName(filename)
-    if newlyLoaded == nil then
-        dofile(datapath .. "gui/scripts/" .. filename)
-        newlyLoaded = winMgr:loadWindowLayout(layoutPath)
-        newlyLoaded.filename = filename
-        loadedGUIs:addGUI(newlyLoaded)
-        -- if there has no GUI been loaded yet, set new GUI as current
-        if #loadedGUIs == 1 then
-            current = loadedGUIs[1]
-            showing = false
-        end
-        -- hide new GUI as we do not want to show it accidentially
-        newlyLoaded:hide()
-    end
-    return newlyLoaded
+function button_server_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState server")
+  hideGUI()
 end
 
--- shows the specified and loads it if not loaded already
--- be sure to set the global variable "filename" before calling this function
-function showGUI()
-    if current == nil or current.filename ~= filename then
-        current = loadedGUIs.getGUIbyName(filename)
-        if current == nil then
-            current = loadGUI(filename)
-        end
-        system:setGUISheet(current)
-    end
-    current:show()
-    cursor:show()
-    showing = true
+function button_dedicated_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState dedicated")
+  hideGUI()
 end
 
-function toggleGUI()
-    if showing == true then
-        current:hide()
-        cursor:hide()
-        showing = false
-    else
-        current:show()
-        cursor:show()
-        showing = true
-    end
-    return showing
+function button_client_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState client")
+  hideGUI()
+end
+
+showBackground = false
+
+function showMainMenu()
+  if showBackground == true then
+    system:setGUISheet(background)
+  else
+    system:setGUISheet(rootSheet)
+  end
+  return 0;
 end
 
 function hideGUI()
-    current:hide()
-    showing = false
+  system:setGUISheet(nil)
+  orxonox.GUIManager:getInstance():hideGUI()
 end
Index: data/media/gui/scripts/loadGUI_2.lua
===================================================================
--- data/media/gui/scripts/loadGUI_2.lua	(revision 5428)
+++ data/media/gui/scripts/loadGUI_2.lua	(revision 5428)
@@ -0,0 +1,88 @@
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+local winMgr = CEGUI.WindowManager:getSingleton()
+local logger = CEGUI.Logger:getSingleton()
+local system = CEGUI.System:getSingleton()
+local cursor = CEGUI.MouseCursor:getSingleton()
+
+schemeMgr:loadScheme("TaharezLookSkin.scheme")
+-- load scheme with our own images
+schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
+
+system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
+system:setDefaultFont("BlueHighway-12")
+
+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
+loadedGUIs.addGUI = function (gui)
+    loadedGUIs[#loadedGUIs+1] = gui
+end
+
+-- function which returns a GUI by name
+loadedGUIs.getGUIbyName = function (str)
+    for i = 1, #loadedGUIs, 1 do
+        if str == loadedGUIs[i].filename then
+            return loadedGUIs[i]
+        end
+    end
+    return nil
+end
+
+-- loads the GUI with the specified filename
+-- be sure to set the global variable "filename" before calling this function
+function loadGUI()
+    -- check if it already exists
+    newlyLoaded = loadedGUIs:getGUIbyName(filename)
+    if newlyLoaded == nil then
+        dofile(datapath .. "gui/scripts/" .. filename)
+        newlyLoaded = winMgr:loadWindowLayout(layoutPath)
+        newlyLoaded.filename = filename
+        loadedGUIs:addGUI(newlyLoaded)
+        -- if there has no GUI been loaded yet, set new GUI as current
+        if #loadedGUIs == 1 then
+            current = loadedGUIs[1]
+            showing = false
+        end
+        -- hide new GUI as we do not want to show it accidentially
+        newlyLoaded:hide()
+    end
+    return newlyLoaded
+end
+
+-- shows the specified and loads it if not loaded already
+-- be sure to set the global variable "filename" before calling this function
+function showGUI()
+    if current == nil or current.filename ~= filename then
+        current = loadedGUIs.getGUIbyName(filename)
+        if current == nil then
+            current = loadGUI(filename)
+        end
+        system:setGUISheet(current)
+    end
+    current:show()
+    cursor:show()
+    showing = true
+end
+
+function toggleGUI()
+    if showing == true then
+        current:hide()
+        cursor:hide()
+        showing = false
+    else
+        current:show()
+        cursor:show()
+        showing = true
+    end
+    return showing
+end
+
+function hideGUI()
+    current:hide()
+    showing = false
+end
