Index: code/branches/resource2/data/gui/scripts/BasicGUI.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/BasicGUI.lua	(revision 5661)
+++ code/branches/resource2/data/gui/scripts/BasicGUI.lua	(revision 5661)
@@ -0,0 +1,42 @@
+-- gui.lua
+
+local P = {}
+if _REQUIREDNAME == nil then
+    BasicGUI = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.overlay = nil
+
+-- constructor of the GUI
+function P:new (gui, fname)
+    local newElement = { window = gui, filename = fname, visible = false } or {}
+    setmetatable(newElement, self) -- connects new element with class
+    self.__index = self
+    return newElement
+end
+
+function P:init()
+-- this function is empty and intended for inheriting GUIs to use
+end
+
+-- hide function for the GUI
+function P:hide ()
+    self.window:hide()
+    self.visible = false
+end
+
+-- show function for the GUI
+function P:show ()
+    self.window:show()
+    self.visible = true
+end
+
+function P:load ()
+    self.window = winMgr:loadWindowLayout(self.layoutString)
+    self:init()
+    return self
+end
+
+return P
Index: code/branches/resource2/data/gui/scripts/IConsole.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/IConsole.lua	(revision 5646)
+++ 	(revision )
@@ -1,50 +1,0 @@
---- Event Handlers ---
-
----------------------------------------------------------
----	Event to handle when "Return" is hit in the edit box
---- Input Window: Console/Frame/Input
----------------------------------------------------------
-function handleEntryAccepted(args)
-	-- Get a pointer to the input editbox
-	local input = this:getWindow() 
-	-- Get a pointer to the output MLEditbox
-	local output = this:getWindow("Console/Frame/ConsoleText")
-	
-	-- Retrieve the Text from the edit box
-	local instr = input:getText()
-		
-	-- Set the Editbox text to an empty string to clear out the entry
-	input:setText("")
-	
-	-- set the text in the output box to its current text + the new text.
-	output:setText(string.format("%s%s",output:getText(),instr))
-	
-	--Done!
-end
-
-function update(args)
-   --Yatta! -- this is called every frame -- Put somthing interesting here!
-end
-
---- End Event Handlers ---
-
---- Entry Point ---
-local winMgr = CEGUI.WindowManager:getSingleton()
-
---- Load the xml for the instanced window we want, specifying true
---- indicates that we are making an instanced window and the system will
---- autogenerate a prefix for us.
-local root = winMgr:loadWindowLayout("Console.wnd",true)
-
---- Since we are just now creating this window, there is no 'this' pointer
---- for us to use. Instead since now we want to set the events we will use
---- the getChild function which will recursivly search from the given node down
---- until it find the window... it will throw an exception.
-root:getChild("Console/Frame/Input"):subscribeEvent("TextAccepted",handleEntryAccepted)
-
---- This event is the window update event, it is called every frame
-root:subscribeEvent("WindowUpdate",update)
-
--- Add it to the default GUI sheet
-CEGUI.System:getSingleton():getGUISheet():addChildWindow(root)
-	
Index: code/branches/resource2/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/InitialiseGUI.lua	(revision 5661)
+++ code/branches/resource2/data/gui/scripts/InitialiseGUI.lua	(revision 5661)
@@ -0,0 +1,84 @@
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+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")
+system:setDefaultTooltip("TaharezLook/Tooltip")
+
+loadedGUIs = {}
+
+-- loads the GUI with the specified filename
+-- be sure to set the global variable "filename" before calling this function
+function loadGUI(filename)
+    -- check if it already exists
+    loadedGui = loadedGUIs[filename]
+    if loadedGui == nil then
+        loadedGuiNS = require(filename)
+        loadedGui = loadedGuiNS:load()
+        loadedGUIs[filename] = loadedGui
+        -- if there has no GUI been loaded yet, set new GUI as current
+        if table.getn(loadedGUIs) == 1 then
+            current = loadedGUIs[1]
+            showing = false
+        end
+        -- hide new GUI as we do not want to show it accidentially
+        loadedGui:hide()
+    end
+    return loadedGui
+end
+
+function showGUI(filename, ptr)
+    gui = showGUI(filename)
+    gui.overlay = ptr
+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(filename)
+    if current == nil or current.filename ~= filename then
+        current = loadedGUIs[filename]
+        if current == nil then
+            current = loadGUI(filename)
+        end
+        system:setGUISheet(current.window)
+    end
+    current:show()
+    showing = true
+    return current
+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 hideCursor()
+    cursor:hide()
+end
+
+function showCursor()
+    cursor:show()
+end
+
+function hideGUI(filename)
+    current = loadedGUIs[filename]
+    if current ~= nil then
+        current:hide()
+        showing = false
+    end
+end
Index: code/branches/resource2/data/gui/scripts/InstancedInit.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/InstancedInit.lua	(revision 5646)
+++ 	(revision )
@@ -1,19 +1,0 @@
---- Init Script for Instanced Windows Demo ---
-local guiSystem = CEGUI.System:getSingleton()
-local schemeMgr = CEGUI.SchemeManager:getSingleton()
-local winMgr = CEGUI.WindowManager:getSingleton()
-
--- Load a Scheme File
-schemeMgr:loadScheme("TaharezLook.scheme")
--- Setup Mouse Pointer
-guiSystem:setDefaultMouseCursor("TaharezLook", "MouseArrow")
--- Setup a DefaultSheet
-local root = winMgr:createWindow("DefaultWindow","RootNode")
-local xx = CEGUI.UDim(1,0)
-local yy = CEGUI.UDim(1,0)
-local zz = CEGUI.UVector2(xx,yy)
-root:setSize(zz)
-guiSystem:setGUISheet(root)
--- set the Tooltip type
-guiSystem:setDefaultTooltip("TaharezLook/Tooltip")
--- Done!
Index: code/branches/resource2/data/gui/scripts/MainMenu.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/MainMenu.lua	(revision 5661)
+++ code/branches/resource2/data/gui/scripts/MainMenu.lua	(revision 5661)
@@ -0,0 +1,92 @@
+-- MainMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    MainMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "MainMenu"
+P.layoutString = "MainMenu.layout"
+
+function P:init()
+    listbox = winMgr:getWindow("orxonox/LevelListbox")
+    preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
+    orxonox.LevelManager:getInstance():compileAvailableLevelList()
+    local levelList = {}
+    local index = 0
+    local level = ""
+    while true do
+      level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
+      if level == "" then
+        break
+      end
+      table.insert(levelList, level)
+      index = index + 1
+    end
+    table.sort(levelList)
+    for k,v in pairs(levelList) do
+        item = CEGUI.createListboxTextItem(v)        
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toListbox(listbox):addItem(item)
+        if v .. ".oxw" == preselect then
+            listbox:setItemSelectState(item, true)
+        end
+    end
+end
+
+
+-- events for mainmenu
+function P.button_quit_clicked(e)
+    hideGUI()
+    orxonox.CommandExecutor:execute("exit")
+end
+
+function P.button_standalone_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startGame")
+        toggleGUI()
+    end
+end
+
+function P.button_server_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startServer")
+        toggleGUI()
+    end
+end
+
+function P.button_dedicated_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startDedicated")
+        toggleGUI()
+    end
+end
+
+function P.button_client_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startClient")
+        toggleGUI()
+    end
+end
+
+function P.listbox_level_selectionchanged(e)
+    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
+        winMgr:getWindow("orxonox/StandaloneButton"):enable()
+    else
+        winMgr:getWindow("orxonox/StandaloneButton"):disable()
+    end
+end
+
+return P
+
Index: code/branches/resource2/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/PickupInventory.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/PickupInventory.lua	(revision 5661)
@@ -1,6 +1,11 @@
-gui = require("gui")
-local P = gui:new() --inherit everything from the gui package
+-- PickupInventory.lua
 
-PickupInventory = P
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    PickupInventory = P
+else
+    _G[_REQUIREDNAME] = P
+end
 
 P.filename = "PickupInventory"
@@ -61,3 +66,3 @@
 end
 
-return PickupInventory
+return P
Index: code/branches/resource2/data/gui/scripts/demo8.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/demo8.lua	(revision 5646)
+++ 	(revision )
@@ -1,83 +1,0 @@
------------------------------------------
--- Start of handler functions
------------------------------------------
------------------------------------------
--- Alpha slider handler (not used!)
------------------------------------------
-function sliderHandler(args)
-    CEGUI.System:getSingleton():getGUISheet():setAlpha(CEGUI.toSlider(CEGUI.toWindowEventArgs(args).window):getCurrentValue())
-end
-
------------------------------------------
--- Handler to slide pane
---
--- Here we move the 'Demo8' sheet window
--- and re-position the scrollbar
------------------------------------------
-function panelSlideHandler(args)
-    local scroller = CEGUI.toScrollbar(CEGUI.toWindowEventArgs(args).window)
-    local demoWnd = CEGUI.WindowManager:getSingleton():getWindow("Demo8")
-
-    local relHeight = demoWnd:getHeight():asRelative(demoWnd:getParentPixelHeight())
-
-    scroller:setPosition(CEGUI.UVector2(CEGUI.UDim(0,0), CEGUI.UDim(scroller:getScrollPosition() / relHeight,0)))
-    demoWnd:setPosition(CEGUI.UVector2(CEGUI.UDim(0,0), CEGUI.UDim(-scroller:getScrollPosition(),0)))
-end
-
------------------------------------------
--- Handler to set preview colour when
--- colour selector scrollers change
------------------------------------------
-function colourChangeHandler(args)
-    local winMgr = CEGUI.WindowManager:getSingleton()
-    
-    local r = CEGUI.toScrollbar(winMgr:getWindow("Demo8/Window1/Controls/Red")):getScrollPosition()
-    local g = CEGUI.toScrollbar(winMgr:getWindow("Demo8/Window1/Controls/Green")):getScrollPosition()
-    local b = CEGUI.toScrollbar(winMgr:getWindow("Demo8/Window1/Controls/Blue")):getScrollPosition()
-    local col = CEGUI.colour:new_local(r, g, b, 1)
-    local crect = CEGUI.ColourRect(col)
-
-    winMgr:getWindow("Demo8/Window1/Controls/ColourSample"):setProperty("ImageColours", CEGUI.PropertyHelper:colourRectToString(crect))
-end
-
-
------------------------------------------
--- Handler to add an item to the box
------------------------------------------
-function addItemHandler(args)
-    local winMgr = CEGUI.WindowManager:getSingleton()
-
-    local text = winMgr:getWindow("Demo8/Window1/Controls/Editbox"):getText()
-    local cols = CEGUI.PropertyHelper:stringToColourRect(winMgr:getWindow("Demo8/Window1/Controls/ColourSample"):getProperty("ImageColours"))
-
-    local newItem = CEGUI.createListboxTextItem(text, 0, nil, false, true)
-    newItem:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
-    newItem:setSelectionColours(cols)
-
-    CEGUI.toListbox(winMgr:getWindow("Demo8/Window1/Listbox")):addItem(newItem)
-end
-
------------------------------------------
--- Script Entry Point
------------------------------------------
-local guiSystem = CEGUI.System:getSingleton()
-local schemeMgr = CEGUI.SchemeManager:getSingleton()
-local winMgr = CEGUI.WindowManager:getSingleton()
-
--- load our demo8 scheme
-schemeMgr:loadScheme("Demo8.scheme");
--- load our demo8 window layout
-local root = winMgr:loadWindowLayout("Demo8.layout")
--- set the layout as the root
-guiSystem:setGUISheet(root)
--- set default mouse cursor
-guiSystem:setDefaultMouseCursor("TaharezLook", "MouseArrow")
--- set the Tooltip type
-guiSystem:setDefaultTooltip("TaharezLook/Tooltip")
-
--- subscribe required events
-winMgr:getWindow("Demo8/ViewScroll"):subscribeEvent("ScrollPosChanged", "panelSlideHandler")
-winMgr:getWindow("Demo8/Window1/Controls/Blue"):subscribeEvent("ScrollPosChanged", "colourChangeHandler")
-winMgr:getWindow("Demo8/Window1/Controls/Red"):subscribeEvent("ScrollPosChanged", "colourChangeHandler")
-winMgr:getWindow("Demo8/Window1/Controls/Green"):subscribeEvent("ScrollPosChanged", "colourChangeHandler")
-winMgr:getWindow("Demo8/Window1/Controls/Add"):subscribeEvent("Clicked", "addItemHandler")
Index: code/branches/resource2/data/gui/scripts/gui.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/gui.lua	(revision 5646)
+++ 	(revision )
@@ -1,42 +1,0 @@
--- gui.lua
-
-local P = {}
-if _REQUIREDNAME == nil then
-    gui = P
-else
-    _G[_REQUIREDNAME] = P
-end
-
-P.overlay = nil
-
--- constructor of the GUI
-function P:new (gui, fname)
-    local newElement = { window = gui, filename = fname, visible = false } or {}
-    setmetatable(newElement, self) -- connects new element with class
-    self.__index = self
-    return newElement
-end
-
-function P:init()
--- this function is empty and intended for inheriting GUIs to use
-end
-
--- hide function for the GUI
-function P:hide ()
-    self.window:hide()
-    self.visible = false
-end
-
--- show function for the GUI
-function P:show ()
-    self.window:show()
-    self.visible = true
-end
-
-function P:load ()
-    self.window = winMgr:loadWindowLayout(self.layoutString)
-    self:init()
-    return self
-end
-
-return gui or _G[_REQUIREDNAME]
Index: code/branches/resource2/data/gui/scripts/inGameTest.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/inGameTest.lua	(revision 5646)
+++ 	(revision )
@@ -1,1 +1,0 @@
-layoutPath = "InGameTest.layout"
Index: code/branches/resource2/data/gui/scripts/loadGUI.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/loadGUI.lua	(revision 5646)
+++ 	(revision )
@@ -1,106 +1,0 @@
-local schemeMgr = CEGUI.SchemeManager:getSingleton()
-local winMgr = CEGUI.WindowManager:getSingleton()
-local logger = CEGUI.Logger:getSingleton()
-local system = CEGUI.System:getSingleton()
-
-schemeMgr:loadScheme("TaharezLookSkin.scheme")
-system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
-system:setDefaultFont("BlueHighway-12")
-
-
-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 button_standalone_clicked(e)
-  orxonox.CommandExecutor:execute("selectGameState standalone")
-  hideGUI()
-end
-
-function button_server_clicked(e)
-  orxonox.CommandExecutor:execute("selectGameState server")
-  hideGUI()
-end
-
-function button_dedicated_clicked(e)
-  orxonox.CommandExecutor:execute("selectGameState dedicated")
-  hideGUI()
-end
-
-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()
-  system:setGUISheet(nil)
-  orxonox.GUIManager:getInstance():hideGUI()
-end
Index: code/branches/resource2/data/gui/scripts/loadGUI_2.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/loadGUI_2.lua	(revision 5646)
+++ 	(revision )
@@ -1,104 +1,0 @@
-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 = {}
--- a bit more complex: GUI is now a class
-GUI = {}
-GUI.__index = GUI
-
--- hide function for the GUI
-GUI.hide = function (self)
-    self.window:hide()
-end
-
--- show function for the GUI
-GUI.show = function (self)
-    self.window:show()
-end
-
--- constructor of the GUI
-GUI.new = function (gui, fname)
-    local newElement = { window = gui, filename = fname }
-    setmetatable(newElement, GUI) -- connects new element with class
-    return newElement
-end
-
-datapath = "" -- points to media-folder (set after loading the script)
-
--- loads the GUI with the specified filename
--- be sure to set the global variable "filename" before calling this function
-function loadGUI(filename)
-    -- check if it already exists
-    --gui = loadedGUIs:getGUIbyName(filename)
-    gui = loadedGUIs[filename]
-    if gui == nil then
-        dofile(datapath .. "gui/scripts/" .. filename .. ".lua")
-        win = winMgr:loadWindowLayout(layoutPath)
-        gui = GUI.new(win, filename)
-        loadedGUIs[filename] = gui
-        -- if there has no GUI been loaded yet, set new GUI as current
-        if table.getn(loadedGUIs) == 1 then
-            current = loadedGUIs[1]
-            showing = false
-        end
-        -- hide new GUI as we do not want to show it accidentially
-        gui:hide()
-    end
-    return gui
-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(filename)
-    if current == nil or current.filename ~= filename then
-        if current ~= nil then
-        end
-        current = loadedGUIs[filename]
-        if current == nil then
-            current = loadGUI(filename)
-        end
-        system:setGUISheet(current.window)
-    end
-    current: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 hideCursor()
-    cursor:hide()
-end
-
-function showCursor()
-    cursor:show()
-end
-
-function hideGUI(filename)
-    current = loadedGUIs[filename]
-    if current ~= nil then
-        current:hide()
-        showing = false
-    end
-end
Index: code/branches/resource2/data/gui/scripts/loadGUI_3.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/loadGUI_3.lua	(revision 5646)
+++ 	(revision )
@@ -1,87 +1,0 @@
-local schemeMgr = CEGUI.SchemeManager:getSingleton()
-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")
-system:setDefaultTooltip("TaharezLook/Tooltip")
-
-loadedGUIs = {}
-
--- datapath is set before executing the script and points to media-folder
-package.path = package.path .. ";" .. datapath .. "gui/scripts/?.lua"
-
--- loads the GUI with the specified filename
--- be sure to set the global variable "filename" before calling this function
-function loadGUI(filename)
-    -- check if it already exists
-    loadedGui = loadedGUIs[filename]
-    if loadedGui == nil then
-        loadedGuiNS = require(filename)
-        loadedGui = loadedGuiNS:load()
-        loadedGUIs[filename] = loadedGui
-        -- if there has no GUI been loaded yet, set new GUI as current
-        if table.getn(loadedGUIs) == 1 then
-            current = loadedGUIs[1]
-            showing = false
-        end
-        -- hide new GUI as we do not want to show it accidentially
-        loadedGui:hide()
-    end
-    return loadedGui
-end
-
-function showGUI(filename, ptr)
-    gui = showGUI(filename)
-    gui.overlay = ptr
-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(filename)
-    if current == nil or current.filename ~= filename then
-        current = loadedGUIs[filename]
-        if current == nil then
-            current = loadGUI(filename)
-        end
-        system:setGUISheet(current.window)
-    end
-    current:show()
-    showing = true
-    return current
-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 hideCursor()
-    cursor:hide()
-end
-
-function showCursor()
-    cursor:show()
-end
-
-function hideGUI(filename)
-    current = loadedGUIs[filename]
-    if current ~= nil then
-        current:hide()
-        showing = false
-    end
-end
Index: code/branches/resource2/data/gui/scripts/mainmenu.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu.lua	(revision 5646)
+++ 	(revision )
@@ -1,27 +1,0 @@
-layoutPath = "MainMenu.layout"
-
--- events for mainmenu
-function button_quit_clicked(e)
-  hideGUI()
-  orxonox.CommandExecutor:execute("exit")
-end
-
-function button_standalone_clicked(e)
-  orxonox.CommandExecutor:execute("startGame")
-  toggleGUI()
-end
-
-function button_server_clicked(e)
-  orxonox.CommandExecutor:execute("echo Not yet supported!")
-  hideGUI()
-end
-
-function button_dedicated_clicked(e)
-  orxonox.CommandExecutor:execute("echo Not yet supported!")
-  hideGUI()
-end
-
-function button_client_clicked(e)
-  orxonox.CommandExecutor:execute("echo Not yet supported!")
-  hideGUI()
-end
Index: code/branches/resource2/data/gui/scripts/mainmenu_2.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu_2.lua	(revision 5646)
+++ 	(revision )
@@ -1,77 +1,0 @@
--- mainmenu_2.lua
-gui = require("gui")
-local P = gui:new() --inherit everything from the gui package
-
-mainmenu_2 = P
-
-P.filename = "mainmenu_2"
-P.layoutString = "MainMenu_2.layout"
-
-function P:init()
-    listbox = winMgr:getWindow("orxonox/LevelListbox")
-    preselect = orxonox.Game:getInstance():getLevel()
-    orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
-    table.sort(levellist)
-    for k,v in pairs(levellist) do
-        item = CEGUI.createListboxTextItem(v)        
-        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
-        CEGUI.toListbox(listbox):addItem(item)
-        if v .. ".oxw" == preselect then
-            listbox:setItemSelectState(item, true)
-        end
-    end
-end
-
-
--- events for mainmenu
-function P.button_quit_clicked(e)
-    hideGUI()
-    orxonox.CommandExecutor:execute("exit")
-end
-
-function P.button_standalone_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startGame")
-        toggleGUI()
-    end
-end
-
-function P.button_server_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startServer")
-        toggleGUI()
-    end
-end
-
-function P.button_dedicated_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startDedicated")
-        toggleGUI()
-    end
-end
-
-function P.button_client_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startClient")
-        toggleGUI()
-    end
-end
-
-function P.listbox_level_selectionchanged(e)
-    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
-        winMgr:getWindow("orxonox/StandaloneButton"):enable()
-    else
-        winMgr:getWindow("orxonox/StandaloneButton"):disable()
-    end
-end
-
-return mainmenu_2
-
Index: code/branches/resource2/data/gui/scripts/mainmenu_3.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu_3.lua	(revision 5646)
+++ 	(revision )
@@ -1,77 +1,0 @@
--- mainmenu_2.lua
-gui = require("gui")
-local P = gui:new() --inherit everything from the gui package
-
-mainmenu_2 = P
-
-P.filename = "mainmenu_2"
-P.layoutString = "MainMenu_2.layout"
-
-function P:init()
-    listbox = winMgr:getWindow("orxonox/LevelListbox")
-    preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
-    orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
-    table.sort(levellist)
-    for k,v in pairs(levellist) do
-        item = CEGUI.createListboxTextItem(v)        
-        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
-        CEGUI.toListbox(listbox):addItem(item)
-        if v .. ".oxw" == preselect then
-            listbox:setItemSelectState(item, true)
-        end
-    end
-end
-
-
--- events for mainmenu
-function P.button_quit_clicked(e)
-    hideGUI()
-    orxonox.CommandExecutor:execute("exit")
-end
-
-function P.button_standalone_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startGame")
-        toggleGUI()
-    end
-end
-
-function P.button_server_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startServer")
-        toggleGUI()
-    end
-end
-
-function P.button_dedicated_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startDedicated")
-        toggleGUI()
-    end
-end
-
-function P.button_client_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startClient")
-        toggleGUI()
-    end
-end
-
-function P.listbox_level_selectionchanged(e)
-    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
-        winMgr:getWindow("orxonox/StandaloneButton"):enable()
-    else
-        winMgr:getWindow("orxonox/StandaloneButton"):disable()
-    end
-end
-
-return mainmenu_2
-
Index: code/branches/resource2/data/gui/scripts/mainmenu_4.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu_4.lua	(revision 5646)
+++ 	(revision )
@@ -1,88 +1,0 @@
--- mainmenu_2.lua
-gui = require("gui")
-local P = gui:new() --inherit everything from the gui package
-
-mainmenu_2 = P
-
-P.filename = "mainmenu_2"
-P.layoutString = "MainMenu_2.layout"
-
-function P:init()
-    listbox = winMgr:getWindow("orxonox/LevelListbox")
-    preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
-    orxonox.LevelManager:getInstance():compileAvailableLevelList()
-    local levelList = {}
-    local index = 0
-    local level = ""
-    while true do
-      level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
-      if level == "" then
-        break
-      end
-      table.insert(levelList, level)
-      index = index + 1
-    end
-    table.sort(levelList)
-    for k,v in pairs(levelList) do
-        item = CEGUI.createListboxTextItem(v)        
-        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
-        CEGUI.toListbox(listbox):addItem(item)
-        if v .. ".oxw" == preselect then
-            listbox:setItemSelectState(item, true)
-        end
-    end
-end
-
-
--- events for mainmenu
-function P.button_quit_clicked(e)
-    hideGUI()
-    orxonox.CommandExecutor:execute("exit")
-end
-
-function P.button_standalone_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startGame")
-        toggleGUI()
-    end
-end
-
-function P.button_server_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startServer")
-        toggleGUI()
-    end
-end
-
-function P.button_dedicated_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startDedicated")
-        toggleGUI()
-    end
-end
-
-function P.button_client_clicked(e)
-    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
-    if choice then
-        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
-        orxonox.CommandExecutor:execute("startClient")
-        toggleGUI()
-    end
-end
-
-function P.listbox_level_selectionchanged(e)
-    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
-        winMgr:getWindow("orxonox/StandaloneButton"):enable()
-    else
-        winMgr:getWindow("orxonox/StandaloneButton"):disable()
-    end
-end
-
-return mainmenu_2
-
