Index: code/branches/pickup2/data/gui/scripts/AudioMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/AudioMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/AudioMenu.lua	(revision 6412)
@@ -0,0 +1,184 @@
+-- AudioMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    AudioMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "AudioMenu"
+P.layoutString = "AudioMenu.layout"
+
+function P:init()
+    soundMgr = orxonox.SoundManager:getInstance()
+    block = false
+    masterscrollbar_active = false
+    musicscrollbar_active = false
+    effectsscrollbar_active = false
+    mastervolume = soundMgr:getVolume(orxonox.SoundType.All)
+    musicvolume = soundMgr:getVolume(orxonox.SoundType.Music)
+    effectsvolume = soundMgr:getVolume(orxonox.SoundType.Effects)
+    mastermute = soundMgr:getMute(orxonox.SoundType.All)
+    musicmute = soundMgr:getMute(orxonox.SoundType.Music)
+    effectsmute = soundMgr:getMute(orxonox.SoundType.Effects)
+    masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
+    musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
+    effectsscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
+    mastermutewindow = tolua.cast(winMgr:getWindow("orxonox/MasterCheckbox"),"CEGUI::Checkbox")
+    musicmutewindow = tolua.cast(winMgr:getWindow("orxonox/MusicCheckbox"),"CEGUI::Checkbox")
+    effectsmutewindow = tolua.cast(winMgr:getWindow("orxonox/EffectsCheckbox"),"CEGUI::Checkbox")
+    masterscrollbarwindow:setScrollPosition(mastervolume)
+    musicscrollbarwindow:setScrollPosition(musicvolume)
+    effectsscrollbarwindow:setScrollPosition(effectsvolume)
+    mastermutewindow:setSelected(mastermute)
+    musicmutewindow:setSelected(musicmute)
+    effectsmutewindow:setSelected(effectsmute)
+    choice = "Default"
+    listboxwindow = winMgr:getWindow("orxonox/AudioThemeListbox")
+    local themeList = {}
+    table.insert(themeList, "Default")
+    table.insert(themeList, "Drum n' Bass")
+    for k,v in pairs(themeList) do
+        item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toListbox(listboxwindow):addItem(item)
+    end
+    if orxonox.getConfig("MoodManager", "mood_") == "dnb" then
+        listboxwindow:setItemSelectState(1,true)
+    else
+        listboxwindow:setItemSelectState(0,true)
+    end
+end
+
+function P.AudioMasterScrollbar_changed(e)
+    if mastermute then
+        block = true
+        mastermutewindow:setSelected(false)
+        block = false
+        mastermute = false
+    end
+    if masterscrollbar_active == false then
+        mastervolume = masterscrollbarwindow:getScrollPosition()
+        orxonox.config("SoundManager", "soundVolume_", mastervolume)
+    end
+end
+
+function P.AudioMasterScrollbar_started(e)
+    masterscrollbar_active = true
+end
+
+function P.AudioMasterScrollbar_ended(e)
+    mastervolume = masterscrollbarwindow:getScrollPosition()
+    orxonox.config("SoundManager", "soundVolume_", mastervolume)
+    masterscrollbar_active = false
+end
+
+function P.AudioMusicScrollbar_changed(e)
+    if musicmute then
+        block = true
+        musicmutewindow:setSelected(false)
+        block = false
+        musicmute = false
+    end
+    if musicscrollbar_active == false then
+        musicvolume = musicscrollbarwindow:getScrollPosition()
+        orxonox.config("SoundManager", "ambientVolume_", musicvolume)
+    end
+end
+
+function P.AudioMusicScrollbar_started(e)
+    musicscrollbar_active = true
+end
+
+function P.AudioMusicScrollbar_ended(e)
+    musicmutewindow:setSelected(false)
+    musicvolume = musicscrollbarwindow:getScrollPosition()
+    orxonox.config("SoundManager", "ambientVolume_", musicvolume)
+    musicscrollbar_active = false
+end
+
+function P.AudioEffectsScrollbar_changed(e)
+    if effectsmute then
+        block = true
+        effectsmutewindow:setSelected(false)
+        block = false
+        effectsmute = false
+    end
+    if effectsscrollbar_active == false then
+        effectsvolume = effectsscrollbarwindow:getScrollPosition()
+        orxonox.config("SoundManager", "effectsVolume_", effectsvolume)
+    end
+end
+
+function P.AudioEffectsScrollbar_started(e)
+    effectsscrollbar_active = true
+end
+
+function P.AudioEffectsScrollbar_ended(e)
+    effectsmutewindow:setSelected(false)
+    effectsvolume = effectsscrollbarwindow:getScrollPosition()
+    orxonox.config("SoundManager", "effectsVolume_", effectsvolume)
+    effectsscrollbar_active = false
+end
+
+function P.AudioMuteMasterCheckbox_clicked(e)
+    if block == false then
+        if mastermute then
+            masterscrollbarwindow:setScrollPosition(mastervolume)
+            mastermute = false
+        else
+            temp = masterscrollbarwindow:getScrollPosition()
+            masterscrollbarwindow:setScrollPosition(0)
+            mastervolume = temp
+            mastermute = true
+        end
+    end
+    soundMgr:toggleMute(orxonox.SoundType.All)
+end
+
+function P.AudioMuteMusicCheckbox_clicked(e)
+    if block == false then
+        if musicmute then
+            musicscrollbarwindow:setScrollPosition(musicvolume)
+            musicmute = false
+        else
+            temp = musicscrollbarwindow:getScrollPosition()
+            musicscrollbarwindow:setScrollPosition(0)
+            musicvolume = temp
+            musicmute = true
+        end
+    end
+    soundMgr:toggleMute(orxonox.SoundType.Music)
+end
+
+function P.AudioMuteEffectsCheckbox_clicked(e)
+    if block == false then
+        if effectsmute then
+            effectsscrollbarwindow:setScrollPosition(effectsvolume)
+            effectsmute = false
+        else
+            temp = effectsscrollbarwindow:getScrollPosition()
+            effectsscrollbarwindow:setScrollPosition(0)
+            effectsvolume = temp
+            effectsmute = true
+        end
+    end
+    soundMgr:toggleMute(orxonox.SoundType.Effects)
+end
+
+function P.AudioThemeListbox_changed(e)
+    if listboxwindow:isItemSelected(1) then
+        orxonox.config("MoodManager", "mood_", "dnb")
+    else
+        orxonox.config("MoodManager", "mood_", "default")
+    end
+end
+
+function P.AudioBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/ControlsMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/ControlsMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/ControlsMenu.lua	(revision 6412)
@@ -0,0 +1,27 @@
+-- ControlsMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    ControlsMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "ControlsMenu"
+P.layoutString = "ControlsMenu.layout"
+
+function P.ControlsMouseControlsButton_clicked(e)
+    showGUI("MouseControlsMenu", true)
+end
+
+function P.ControlsKeyboardControlsButton_clicked(e)
+    showGUI("KeyBindMenu", true)
+end
+
+function P.ControlsBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/CreditsMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/CreditsMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/CreditsMenu.lua	(revision 6412)
@@ -0,0 +1,19 @@
+-- CreditsMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    CreditsMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "CreditsMenu"
+P.layoutString = "CreditsMenu.layout"
+
+function P.CreditsBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/DecisionPopup.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/DecisionPopup.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/DecisionPopup.lua	(revision 6412)
@@ -0,0 +1,41 @@
+-- DecisionPopup.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    DecisionPopup = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "DecisionPopup"
+P.layoutString = "DecisionPopup.layout"
+
+function P:init()
+end
+
+function P.setCallback(functionPtr)
+    P.functionPtr = functionPtr
+end
+
+function P.setText( text )
+    winMgr:getWindow("orxonox/DecisionPopup_text"):setText( text )
+end
+
+-- events for ingamemenu
+function P.button_yes(e)
+    if P.functionPtr ~= nil then
+        P.functionPtr(true)
+    end
+    hideGUI("DecisionPopup")
+end
+
+function P.button_no(e)
+    if P.functionPtr ~= nil then
+        P.functionPtr(false)
+    end
+    hideGUI("DecisionPopup")
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/GUITools.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/GUITools.lua	(revision 6412)
@@ -0,0 +1,31 @@
+function openDecisionPopup( text, callbackPtr )
+    showGUI("DecisionPopup", false, true)
+    DecisionPopup.setCallback(callbackPtr)
+    DecisionPopup.setText(text)
+end
+
+function openInfoPopup(text, functionPtr, closeButton, arguments)
+    showGUI("InfoPopup", false, true)
+    InfoPopup.execute(functionPtr, arguments)
+    InfoPopup.setText(text)
+    InfoPopup.setCloseButton(closeButton)
+end
+
+function getMinTextSize(window)
+    local size = {}
+
+    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
+    local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
+    local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
+
+    table.insert(size, height)
+    table.insert(size, width)
+    return size
+end
+
+function getScrollingStepSize(window)
+    local height = window:getUnclippedPixelRect():getHeight()
+    local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight()
+    local ratio = height/maxHeight
+    return 0.008*ratio/0.3204
+end
Index: code/branches/pickup2/data/gui/scripts/GameplayMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/GameplayMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/GameplayMenu.lua	(revision 6412)
@@ -0,0 +1,52 @@
+-- GameplayMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    GameplayMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "GameplayMenu"
+P.layoutString = "GameplayMenu.layout"
+
+function P:init()
+    dropdown = winMgr:getWindow("orxonox/ThemeCombobox")
+    local themeList = {}
+    table.insert(themeList, "Theme 1")
+    table.insert(themeList, "Theme 2")
+    table.insert(themeList, "Theme 3")
+    for k,v in pairs(themeList) do
+        item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toCombobox(dropdown):addItem(item)
+    end
+end
+
+function P.GameplayThemeCombobox_changed(e)
+    -- theme
+    debug("event: theme")
+end
+
+function P.GameplayDifficultyEasyButton_clicked(e)
+    -- difficulty easy
+    debug("event: easy")
+end
+
+function P.GameplayDifficultyNormalButton_clicked(e)
+    -- difficulty normal
+    debug("event: normal")
+end
+
+function P.GameplayDifficultyHardButton_clicked(e)
+    -- difficulty hard
+    debug("event: hard")
+end
+
+function P.GameplayBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/GraphicsMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/GraphicsMenu.lua	(revision 6412)
@@ -0,0 +1,207 @@
+-- GraphicsMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    GraphicsMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "GraphicsMenu"
+P.layoutString = "GraphicsMenu.layout"
+
+function P:init()
+    block = true
+    file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
+    search_mode = 0
+    f = io.open(file, "r")
+    firstline = f:read("*line")
+    rendersystem = string.sub(firstline, 15)
+    for line in f:lines() do
+        if search_mode == 0 then
+            if string.find(line, rendersystem) ~= nil then
+                search_mode = 1
+            end
+        end
+        if search_mode == 1 then
+            if string.sub(line, 1, 11) == "Full Screen" then
+                if string.sub(line, 13) == "Yes" then
+                    fullscreen = true
+                else
+                    fullscreen = false
+                end
+            end
+            if string.sub(line, 1, 10) == "Video Mode" then
+                if string.match(line, "@") == "@" then
+                    resolution = string.sub(line, 12, string.find(line, "@")-2)
+                else
+                    resolution = string.sub(line, 12)
+                end
+                break
+            end
+        end
+    end
+    f:close()
+    local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox")
+    fullscreenwindow:setSelected(fullscreen)
+    listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox")
+    local resolutionList = {}
+    table.insert(resolutionList, "640 x 480")
+    table.insert(resolutionList, "720 x 480")
+    table.insert(resolutionList, "720 x 576")
+    table.insert(resolutionList, "800 x 480")
+    table.insert(resolutionList, "800 x 600")
+    table.insert(resolutionList, "1024 x 480")
+    table.insert(resolutionList, "1024 x 600")
+    table.insert(resolutionList, "1024 x 768")
+    table.insert(resolutionList, "1152 x 864")
+    table.insert(resolutionList, "1280 x 720")
+    table.insert(resolutionList, "1280 x 768")
+    table.insert(resolutionList, "1440 x 900")
+    for k,v in pairs(resolutionList) do
+        item = CEGUI.createListboxTextItem(v)
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toListbox(listboxwindow):addItem(item)
+    end
+    if resolution == "640 x 480" then
+        listboxwindow:setItemSelectState(0,true)
+    elseif resolution == "720 x 480" then
+        listboxwindow:setItemSelectState(1,true)
+    elseif resolution == "720 x 576" then
+        listboxwindow:setItemSelectState(2,true)
+    elseif resolution == "800 x 480" then
+        listboxwindow:setItemSelectState(3,true)
+    elseif resolution == "800 x 600" then
+        listboxwindow:setItemSelectState(4,true)
+    elseif resolution == "1024 x 480" then
+        listboxwindow:setItemSelectState(5,true)
+    elseif resolution == "1024 x 600" then
+        listboxwindow:setItemSelectState(6,true)
+    elseif resolution == "1024 x 768" then
+        listboxwindow:setItemSelectState(7,true)
+    elseif resolution == "1152 x 864" then
+        listboxwindow:setItemSelectState(8,true)
+    elseif resolution == "1280 x 720" then
+        listboxwindow:setItemSelectState(9,true)
+    elseif resolution == "1280 x 768" then
+        listboxwindow:setItemSelectState(10,true)
+    elseif resolution == "1440 x 900" then
+        listboxwindow:setItemSelectState(11,true)
+    end
+    scrollbar_active = false
+    block = false
+end
+
+function P.GraphicsResolutionListbox_changed(e)
+    if listboxwindow:isItemSelected(0) then
+        resolution = "640 x 480"
+    elseif listboxwindow:isItemSelected(1) then
+        resolution = "720 x 480"
+    elseif listboxwindow:isItemSelected(2) then
+        resolution = "720 x 576"
+    elseif listboxwindow:isItemSelected(3) then
+        resolution = "800 x 480"
+    elseif listboxwindow:isItemSelected(4) then
+        resolution = "800 x 600"
+    elseif listboxwindow:isItemSelected(5) then
+        resolution = "1024 x 480"
+    elseif listboxwindow:isItemSelected(6) then
+        resolution = "1024 x 600"
+    elseif listboxwindow:isItemSelected(7) then
+        resolution = "1024 x 768"
+    elseif listboxwindow:isItemSelected(8) then
+        resolution = "1152 x 864"
+    elseif listboxwindow:isItemSelected(9) then
+        resolution = "1280 x 720"
+    elseif listboxwindow:isItemSelected(10) then
+        resolution = "1280 x 768"
+    elseif listboxwindow:isItemSelected(11) then
+        resolution = "1440 x 900"
+    end
+    search_mode = 0
+    f = io.open(file, "r")
+    firstline = f:read("*line")
+    text = firstline .. "\n"
+    rendersystem = string.sub(firstline, 15)
+    for line in f:lines() do
+        if search_mode == 0 then
+            if string.find(line, rendersystem) ~= nil then
+                search_mode = 1
+            end
+        end
+        if search_mode == 1 then
+            if string.sub(line, 1, 10) == "Video Mode" then
+                if string.match(line, "@") == "@" then
+                    line = "Video Mode=" .. resolution .. string.sub(line, string.find(line, "@")-1)
+                else
+                    line = "Video Mode=" .. resolution
+                end
+                search_mode = 2
+            end
+        end
+        text = text .. line .. "\n"
+    end
+    f:close()
+    f = io.open(file, "w")
+    f:write(text)
+    f:close()
+end
+
+function P.GraphicsBrightnessScrollbar_changed(e)
+    if scrollbar_active == false then
+        -- brightness
+        debug("event: brightness")
+    end
+end
+
+function P.GraphicsBrightnessScrollbar_started(e)
+    scrollbar_active = true
+end
+
+function P.GraphicsBrightnessScrollbar_ended(e)
+    -- brightness
+    debug("event: brightness")
+    scrollbar_active = false
+end
+
+function P.GraphicsFullscreenCheckbox_clicked(e)
+    if block == false then
+        search_mode = 0
+        f = io.open(file, "r")
+        firstline = f:read("*line")
+        text = firstline .. "\n"
+        rendersystem = string.sub(firstline, 15)
+        for line in f:lines() do
+            if search_mode == 0 then
+                if string.find(line, rendersystem) ~= nil then
+                    search_mode = 1
+                end
+            end
+            if search_mode == 1 then
+                if string.sub(line, 1, 11) == "Full Screen" then
+                    if fullscreen == true then
+                        line = "Full Screen=No"
+                        fullscreen = false
+                    else
+                        line = "Full Screen=Yes"
+                        fullscreen = true
+                    end
+                    search_mode = 2
+                end
+            end
+            text = text .. line .. "\n"
+        end
+        f:close()
+        f = io.open(file, "w")
+        f:write(text)
+        f:close()
+    end
+end
+
+function P.GraphicsBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/InGameMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/InGameMenu.lua	(revision 6412)
@@ -0,0 +1,46 @@
+-- InGameMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    InGameMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "InGameMenu"
+P.layoutString = "InGameMenu.layout"
+
+function P:init()
+end
+
+
+-- events for ingamemenu
+function P.button_quit_clicked(e)
+    openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback )
+end
+
+function P.button_mainmenu_clicked(e)
+    orxonox.Game:getInstance():popState()
+    orxonox.Game:getInstance():popState()
+    orxonox.Game:getInstance():requestState("mainmenu")
+    hideGUI("InGameMenu")
+end
+
+function P.button_settings_clicked(e)
+    showGUI("SettingsMenu", true)
+end
+
+function P.button_return_clicked(e)
+    hideGUI("InGameMenu")
+end
+
+function P.callback(doExit)
+    if doExit then
+        hideGUI("InGameMenu")
+        orxonox.execute("exit")
+    end
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/InfoPopup.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/InfoPopup.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/InfoPopup.lua	(revision 6412)
@@ -0,0 +1,47 @@
+-- InfoPopup.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+
+if _REQUIREDNAME == nil then
+    InfoPopup = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "InfoPopup"
+P.layoutString = "InfoPopup.layout"
+
+function P:init()
+end
+
+function P.execute(functionPtr, arguments)
+    if functionPtr ~= nil then
+        if arguments ~= nil then
+            functionPtr(arguments)
+        else
+            functionPtr()
+        end
+    end
+end
+
+function P.setText( text )
+    winMgr:getWindow("orxonox/InfoPopup_text"):setText( text )
+end
+
+function P.setCloseButton(closeButton)
+    close = winMgr:getWindow("orxonox/InfoPopup_close")
+    close:setVisible(closeButton)
+    if(not closeButton) then
+        close:deactivate();
+    else
+        close:activate();
+    end
+end
+
+-- events for ingamemenu
+function P.close(e)
+    hideGUI("InfoPopup")
+end
+
+return P
Index: code/branches/pickup2/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/InitialiseGUI.lua	(revision 5942)
+++ code/branches/pickup2/data/gui/scripts/InitialiseGUI.lua	(revision 6412)
@@ -14,4 +14,13 @@
 
 loadedGUIs = {}
+cursorVisibility = {}
+activeSheets = {}
+nrOfActiveSheets = 0
+root = nil
+bShowsCursor = false
+bHidePrevious = {}
+
+-- Require all tools
+require("GUITools")
 
 -- loads the GUI with the specified filename
@@ -22,4 +31,7 @@
     if loadedGui == nil then
         loadedGuiNS = require(filename)
+        if loadedGuiNS == nil then
+            return
+        end
         loadedGui = loadedGuiNS:load()
         loadedGUIs[filename] = loadedGui
@@ -27,5 +39,4 @@
         if table.getn(loadedGUIs) == 1 then
             current = loadedGUIs[1]
-            showing = false
         end
         -- hide new GUI as we do not want to show it accidentially
@@ -35,6 +46,6 @@
 end
 
-function showGUI(filename, ptr)
-    gui = showGUI(filename)
+function showGUI(filename, hidePrevious, bCursorVisible, ptr)
+    gui = showGUI(filename, hidePrevious, bCursorVisible)
     gui.overlay = ptr
 end
@@ -42,43 +53,175 @@
 -- 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()
+function showGUI(filename, hidePrevious, bCursorVisible)
+    if bCursorVisible == nil then
+        if nrOfActiveSheets > 0 then
+            bCursorVisible = cursorVisibility[activeSheets[nrOfActiveSheets]]
+        else
+            bCursorVisible = true
+        end
+    end
+
+    if root == nil then
+        setBackground("")
+    end
+
+    local currentGUI = loadedGUIs[filename]
+    if(currentGUI == nil) then
+        currentGUI = loadGUI(filename)
+    end
+
+    if(root:isChild(currentGUI.window)) then
+        root:removeChildWindow(currentGUI.window)
+    end
+    root:addChildWindow(currentGUI.window)
+
+    if bCursorVisible then
+        showCursor()
+    else
+        hideCursor()
+    end
+
+    if find( activeSheets, filename ) ~= nil then
+        table.remove( activeSheets, find( activeSheets, filename ) )
+        nrOfActiveSheets = nrOfActiveSheets - 1
+    else
+        if nrOfActiveSheets == 0 then
+            orxonox.InputManager:getInstance():enterState("guiMouseOnly")
+            orxonox.HumanController:pauseControl()
+        end
+    end
+    nrOfActiveSheets = nrOfActiveSheets + 1
+    table.insert(activeSheets, filename)
+    activeSheets[nrOfActiveSheets] = filename
+    bHidePrevious[filename]=hidePrevious
+    cursorVisibility[filename] = bCursorVisible
+
+    if hidePrevious == true then
+        for i=1,nrOfActiveSheets-1 do
+            loadedGUIs[ activeSheets[i] ]:hide()
+        end
+    end
+    currentGUI:show()
+    return currentGUI
+end
+
+function hideCursor()
+    if bShowsCursor==true then
+        bShowsCursor=false
         cursor:hide()
-        showing = false
-    else
-        current:show()
+    end
+end
+
+function showCursor()
+    if bShowsCursor==false then
+        bShowsCursor=true
         cursor:show()
-        showing = true
-    end
-    return showing
-end
-
-function hideCursor()
-    cursor:hide()
-end
-
-function showCursor()
-    cursor:show()
+    end
 end
 
 function hideGUI(filename)
-    current = loadedGUIs[filename]
-    if current ~= nil then
-        current:hide()
-        showing = false
-    end
-end
+    local currentGUI = loadedGUIs[filename]
+    if currentGUI == nil then
+        return
+    end
+    currentGUI:hide()
+    if bHidePrevious[filename] == true then
+        local i = nrOfActiveSheets-1
+        while i>0 do
+            loadedGUIs[ activeSheets[i] ]:show()
+            if bHidePrevious[filename]==true then
+                break
+            else
+                i=i-1
+            end
+        end
+    end
+    root:removeChildWindow(currentGUI.window)
+    local i=1
+    while activeSheets[i] do
+        if activeSheets[i+1] == nil then
+            if activeSheets[i-1] ~= nil then
+                if cursorVisibility[ activeSheets[i-1] ] == true then
+                    showCursor()
+                else
+                    hideCursor()
+                end
+            else
+                hideCursor()
+            end
+        end
+        if activeSheets[i] == filename then
+            table.remove( activeSheets, i )
+            nrOfActiveSheets = nrOfActiveSheets-1
+        else
+            i = i+1
+        end
+    end
+    cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table
+    bHidePrevious[filename] = nil
+    if nrOfActiveSheets == 0 then
+        orxonox.InputManager:getInstance():leaveState("guiMouseOnly")
+        orxonox.HumanController:resumeControl()
+        hideCursor()
+    end
+end
+
+function hideAllGUIs()
+    while nrOfActiveSheets ~= 0 do
+        hideGUI(activeSheets[nrOfActiveSheets])
+    end
+end
+
+function keyESC()
+    if nrOfActiveSheets == 1 and activeSheets[1] == "MainMenu" then
+        orxonox.execute("exit")
+    elseif nrOfActiveSheets > 0 then
+        orxonox.execute("hideGUI "..activeSheets[nrOfActiveSheets])
+    else
+        showGUI("InGameMenu")
+    end
+end
+
+function setBackground(filename)
+    local newroot
+    if root ~= nil then
+        root:rename("oldRootWindow")
+    end
+    if filename ~= "" then
+        newroot = winMgr:loadWindowLayout(filename .. ".layout")
+        newroot:rename("AbsoluteRootWindow")
+        system:setGUISheet(newroot)
+    else
+        newroot = winMgr:createWindow("DefaultWindow", "AbsoluteRootWindow")
+        newroot:setProperty("Alpha", "0.0")
+        newroot:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0)))
+        system:setGUISheet(newroot)
+    end
+    if root ~= nil then
+        local child
+        while root:getChildCount()~=0 do
+            child = root:getChildAtIdx(0)
+            root:removeChildWindow(child)
+            newroot:addChildWindow(child)
+        end
+        winMgr:destroyWindow(root)
+    end
+    newroot:show()
+    root = newroot
+end
+
+function find(table, value)
+    local i=0
+    while table[i] ~= nil do
+        if table[i]==value then
+            return i
+        else
+            i=i+1
+        end
+    end
+    return nil
+end
+
+function test(e)
+    debug(0, "Blubb")
+end
Index: code/branches/pickup2/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/KeyBindMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/KeyBindMenu.lua	(revision 6412)
@@ -0,0 +1,257 @@
+-- KeyBindMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+
+if _REQUIREDNAME == nil then
+    KeyBindMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "KeyBindMenu"
+P.layoutString = "KeyBindMenu.layout"
+
+function P:init()
+
+    commandList = {}
+    table.insert(commandList, "fire 0")
+    table.insert(commandList, "fire 1 | unfire")
+    table.insert(commandList, "onpress fire 2")
+    table.insert(commandList, "scale 1 moveFrontBack")
+    table.insert(commandList, "scale -1 moveFrontBack")
+    table.insert(commandList, "boost")
+    table.insert(commandList, "scale 1 moveRightLeft")
+    table.insert(commandList, "scale -1 moveRightLeft")
+    table.insert(commandList, "scale 1 moveUpDown")
+    table.insert(commandList, "scale -1 moveUpDown")
+    table.insert(commandList, "scale -1 rotateRoll")
+    table.insert(commandList, "scale 1 rotateRoll")
+    table.insert(commandList, "scale 1 rotateYaw")
+    table.insert(commandList, "scale -1 rotateYaw")
+    table.insert(commandList, "scale 1 rotatePitch")
+    table.insert(commandList, "scale -1 rotatePitch")
+    table.insert(commandList, "NewHumanController changeMode")
+    table.insert(commandList, "switchCamera")
+    table.insert(commandList, "openConsole")
+    table.insert(commandList, "OverlayGroup toggleVisibility Debug")
+    table.insert(commandList, "OverlayGroup toggleVisibility Stats")
+    table.insert(commandList, "mouseLook")
+    table.insert(commandList, "pause")
+
+    nameList = {}
+    table.insert(nameList, "Primary Fire")
+    table.insert(nameList, "Secondary Fire")
+    table.insert(nameList, "Fire Rocket")
+    table.insert(nameList, "Accelerate")
+    table.insert(nameList, "Break")
+    table.insert(nameList, "Boost")
+    table.insert(nameList, "Move Right")
+    table.insert(nameList, "Move Left")
+    table.insert(nameList, "Move Up")
+    table.insert(nameList, "Move Down")
+    table.insert(nameList, "Roll Right")
+    table.insert(nameList, "Roll Left")
+    table.insert(nameList, "Yaw Left")
+    table.insert(nameList, "Yaw Right")
+    table.insert(nameList, "Pitch Up")
+    table.insert(nameList, "Pitch Down")
+    table.insert(nameList, "Switch Input Mode")
+    table.insert(nameList, "Switch Camera")
+    table.insert(nameList, "Open Console")
+    table.insert(nameList, "Show Debug")
+    table.insert(nameList, "Show Stats")
+    table.insert(nameList, "Look Around")
+    table.insert(nameList, "Pause")
+
+    linesList = {}
+
+    --Calculate design parameters:
+    sampleWindow = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/SampleWindow")
+    sampleWindow:setText("SampleText")
+
+    local size = getMinTextSize(sampleWindow)
+    lineHeight = size[1]
+
+    commandWidth = 0
+    for k,v in pairs(commandList) do
+        sampleWindow:setText(nameList[k])
+        size = getMinTextSize(sampleWindow)
+        if size[2] > commandWidth then
+            commandWidth = size[2]
+        end
+    end
+
+    sampleWindow:setText("add")
+    size = getMinTextSize(sampleWindow)
+    addWidth = size[2]
+
+    sampleWindow:setText("X")
+    size = getMinTextSize(sampleWindow)
+    clearWidth = size[2]
+
+    spaceWidth = math.floor(1/14*commandWidth)
+
+    buttonWidth = 145
+
+    P.createLines()
+
+    local funct = luaState:createLuaFunctor("KeyBindMenu.callback()")
+    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
+end
+
+function P.KeyNameNiceifier(key)
+    local name = string.sub(key, string.find(key, '%.(.*)')+1)
+    local group = string.sub(key, string.find(key, '(.*)%.'))
+    group = string.sub(group,1,string.len(group)-1)
+    if( group == "Keys") then
+        return "Key " .. string.sub(name, string.find(name, 'Key(.*)')+3)
+    elseif( group == "MouseButtons") then
+        return "Mouse " .. name
+    elseif( string.find(group, "JoyStickButtons") ~= nil ) then
+        return "Joystick " .. name
+    elseif( string.find(group, "JoyStickAxes") ~= nil ) then
+        return "Joystick Axis" .. string.sub(name, 5, 6) .. string.sub(name, string.find(name, 'Axis%d%d(.*)')+6)
+    elseif( group == "MouseAxes" ) then
+        return "Mouse " .. string.sub(name, string.find(name, '.(.*)')+1) .. " " .. string.sub(name, 1, 1) .. "-Axis"
+    end
+    return key
+end
+
+function P.createLine(k)
+    local offset = 0
+    local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
+    line:setHeight(CEGUI.UDim(0, lineHeight))
+    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1))))
+
+    local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
+    command:setText(nameList[k])
+    command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))
+    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
+    line:addChildWindow(command)
+    offset = offset + commandWidth + spaceWidth
+
+    local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus")
+    plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0)))
+    plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
+    plus:setText("add")
+    orxonox.GUIManager:subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked")
+    line:addChildWindow(plus)
+    offset = offset + addWidth + spaceWidth
+
+    local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]);
+    for i=0,(numButtons-1) do
+        local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)
+        local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)
+        name = P.KeyNameNiceifier(name)
+        button:setText(name)
+        sampleWindow:setText(name)
+        local size = getMinTextSize(sampleWindow)
+        local buttonWidth = size[2]
+        button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
+        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
+        orxonox.GUIManager:subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
+        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
+        line:addChildWindow(button)
+        offset = offset + buttonWidth
+
+        local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)
+        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))
+        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
+        clear:setText("X")
+        orxonox.GUIManager:subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
+        line:addChildWindow(clear)
+        offset = offset + clearWidth + spaceWidth
+    end
+
+    line:setWidth(CEGUI.UDim(0, offset+clearWidth))
+
+    return line
+end
+
+function P.createLines()
+    local window = winMgr:getWindow("orxonox/KeyBindPane")
+
+    for k,v in pairs(commandList) do
+        local line = P.createLine(k)
+        table.insert(linesList, line)
+        window:addChildWindow(line)
+    end
+
+    pane = tolua.cast(window, "CEGUI::ScrollablePane")
+    pane:setVerticalStepSize(getScrollingStepSize(window))
+end
+
+function P.KeyBindButton_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+    local buttonNr = tonumber(match())
+
+    local arguments = {}
+    arguments[1] = commandNr
+    arguments[2] = buttonNr
+    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments)
+end
+
+function P.KeyBindPlus_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+
+    local arguments = {}
+    arguments[1] = commandNr
+    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments)
+end
+
+function P.KeyBindClear_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+    local buttonNr = tonumber(match())
+
+    orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr))
+
+    P.callback()
+end
+
+function P.keybind(arguments)
+    local commandNr = arguments[1]
+    local buttonNr = arguments[2]
+    if buttonNr ~= nil then
+        orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr))
+    end
+
+    orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr])
+end
+
+function P.callback()
+    local pane = tolua.cast(winMgr:getWindow("orxonox/KeyBindPane"), "CEGUI::ScrollablePane")
+    local position = pane:getVerticalScrollPosition()
+    while table.getn(linesList) ~= 0 do
+        if linesList[1] ~= nil then
+            winMgr:destroyWindow(linesList[1]:getName())
+        end
+        table.remove(linesList, 1)
+    end
+
+    linesList = {}
+
+    P.createLines()
+    if(InfoPopup ~= nil) then
+        InfoPopup.close()
+    end
+    pane:setVerticalScrollPosition( position )
+end
+
+function P.KeyBindBackButton_clicked(e)
+    hideGUI("KeyBindMenu")
+end
+
+return P
Index: code/branches/pickup2/data/gui/scripts/MainMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/MainMenu.lua	(revision 5942)
+++ code/branches/pickup2/data/gui/scripts/MainMenu.lua	(revision 6412)
@@ -12,79 +12,27 @@
 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
+-- events for MainMenu
+function P.QuickGameTestButton_clicked(e)
+    orxonox.execute("startGame")
 end
 
-
--- events for mainmenu
-function P.button_quit_clicked(e)
-    hideGUI()
-    orxonox.CommandExecutor:execute("exit")
+function P.SingleplayerButton_clicked(e)
+    showGUI("SingleplayerMenu", true)
 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
+function P.MultiplayerButton_clicked(e)
+    showGUI("MultiplayerMenu", true)
 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
+function P.SettingsButton_clicked(e)
+    showGUI("SettingsMenu", true)
 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
+function P.CreditsButton_clicked(e)
+    showGUI("CreditsMenu", true)
 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
+function P.ExitButton_clicked(e)
+    orxonox.execute("exit")
 end
 
Index: code/branches/pickup2/data/gui/scripts/MouseControlsMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/MouseControlsMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/MouseControlsMenu.lua	(revision 6412)
@@ -0,0 +1,110 @@
+-- MouseControlsMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    MouseControlsMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "MouseControlsMenu"
+P.layoutString = "MouseControlsMenu.layout"
+
+function P:init()
+    block = false
+    mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar")
+    mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar")
+    normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton")
+    derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton")
+    invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox")
+    mousenormalscrollbar_active = false
+    mousederivescrollbar_active = false
+    derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_")
+    invert_active = false
+    mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_")
+    mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_")
+    mousenormalscrollbarwindow:setScrollPosition((math.log(14*mousenormalsensitivity-6))/(6*math.log(2)))
+    mousederivescrollbarwindow:setScrollPosition((math.log(14*mousederivesensitivity-6))/(6*math.log(2)))
+    if derive_active == "true" then
+        normal_active = false
+        derive_active = true
+        derivewindow:setSelected(derive_active)
+    else
+        normal_active = true
+        derive_active = false
+        normalwindow:setSelected(normal_active)
+    end
+    if invert_active == "true" then
+        invert_active = true
+    else
+        invert_active = false
+    end
+end
+
+function P.MouseControlsMouseNormalScrollbar_changed(e)
+    if mousenormalscrollbar_active == false then
+        scrollposition = mousenormalscrollbarwindow:getScrollPosition()
+        mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
+        orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
+    end
+end
+
+function P.MouseControlsMouseNormalScrollbar_started(e)
+    mousenormalscrollbar_active = true
+end
+
+function P.MouseControlsMouseNormalScrollbar_ended(e)
+    scrollposition = mousenormalscrollbarwindow:getScrollPosition()
+    mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
+    orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
+    mousenormalscrollbar_active = false
+end
+
+function P.MouseControlsMouseDeriveScrollbar_changed(e)
+    if mousederivescrollbar_active == false then
+        scrollposition = mousederivescrollbarwindow:getScrollPosition()
+        mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
+        orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
+    end
+end
+
+function P.MouseControlsMouseDeriveScrollbar_started(e)
+    mousederivescrollbar_active = true
+end
+
+function P.MouseControlsMouseDeriveScrollbar_ended(e)
+    scrollposition = mousederivescrollbarwindow:getScrollPosition()
+    mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
+    orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
+    mousederivescrollbar_active = false
+end
+
+function P.MouseNormalButton_clicked(e)
+    if block == false then
+        block = true
+        derivewindow:setSelected(false)
+        block = false
+        orxonox.config("KeyBinder", "bDeriveMouseInput_", 0)
+    end
+end
+
+function P.MouseDeriveButton_clicked(e)
+    if block == false then
+        block = true
+        normalwindow:setSelected(false)
+        block = false
+        orxonox.config("KeyBinder", "bDeriveMouseInput_", 1)
+    end
+end
+
+function P.MouseInvertCheckbox_clicked(e)
+    -- invert mouse
+end
+
+function P.MouseControlsBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/MultiplayerMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/MultiplayerMenu.lua	(revision 6412)
@@ -0,0 +1,82 @@
+-- MultiplayerMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    MultiplayerMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "MultiplayerMenu"
+P.layoutString = "MultiplayerMenu.layout"
+
+function P:init()
+    listbox = winMgr:getWindow("orxonox/MultiplayerLevelListbox")
+    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
+    local multiplayerMode = "startClient"
+    if multiplayerMode == "startClient" then
+        window = winMgr:getWindow("orxonox/MultiplayerJoinButton")
+        button = tolua.cast(window,"CEGUI::RadioButton")
+        button:setSelected(true)
+    end
+    if multiplayerMode == "startServer" then
+        window = winMgr:getWindow("orxonox/MultiplayerHostButton")
+        button = tolua.cast(window,"CEGUI::RadioButton")
+        button:setSelected(true)
+    end
+    if multiplayerMode == "startDedicated" then
+        window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton")
+        button = tolua.cast(window,"CEGUI::RadioButton")
+        button:setSelected(true)
+    end
+end
+
+function P.MultiplayerJoinButton_clicked(e)
+    multiplayerMode = "startClient"
+end
+
+function P.MultiplayerHostButton_clicked(e)
+    multiplayerMode = "startServer"
+end
+
+function P.MultiplayerDedicatedButton_clicked(e)
+    multiplayerMode = "startDedicated"
+end
+
+function P.MultiplayerStartButton_clicked(e)
+    local choice = winMgr:getWindow("orxonox/MultiplayerLevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.execute(multiplayerMode)
+        hideAllGUIs()
+    end
+end
+
+function P.MultiplayerBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/MultiplayerOptionsMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/MultiplayerOptionsMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/MultiplayerOptionsMenu.lua	(revision 6412)
@@ -0,0 +1,18 @@
+-- MultiplayerOptionsMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    MultiplayerOptionsMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "MultiplayerOptionsMenu"
+P.layoutString = "MultiplayerOptionsMenu.layout"
+
+function P.MultiplayerOptionsBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
Index: code/branches/pickup2/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/PickupInventory.lua	(revision 5942)
+++ code/branches/pickup2/data/gui/scripts/PickupInventory.lua	(revision 6412)
@@ -20,5 +20,5 @@
     local equipCount = orxonox.PickupInventory:getEquipmentCount()
     local usableCount = orxonox.PickupInventory:getUsableCount()
-    
+
     if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then
         self:updateTabs()
@@ -39,9 +39,9 @@
     local t = name:sub(25, 27)
     local i = name:sub(29)
-    
+
     if t == "equ" then
-        
+
     end
-    
+
     if t == "use" then
         if self.currentUsableID_ >= 0 then
@@ -60,5 +60,5 @@
     orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin)
     orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin)
-    
+
     self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
     self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
Index: code/branches/pickup2/data/gui/scripts/QuestGUI.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/QuestGUI.lua	(revision 5942)
+++ code/branches/pickup2/data/gui/scripts/QuestGUI.lua	(revision 6412)
@@ -15,5 +15,5 @@
 
     local questManager = orxonox.QuestManager:getInstance()
-      
+
     local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList")
 
Index: code/branches/pickup2/data/gui/scripts/SettingsMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/SettingsMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/SettingsMenu.lua	(revision 6412)
@@ -0,0 +1,44 @@
+-- SettingsMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    SettingsMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "SettingsMenu"
+P.layoutString = "SettingsMenu.layout"
+
+function P.SettingsGameplayButton_clicked(e)
+    showGUI("GameplayMenu", true)
+end
+
+function P.SettingsMultiplayerOptionsButton_clicked(e)
+    showGUI("MultiplayerOptionsMenu", true)
+end
+
+function P.SettingsControlsButton_clicked(e)
+    showGUI("ControlsMenu", true)
+end
+
+function P.SettingsGraphicsButton_clicked(e)
+    showGUI("GraphicsMenu", true)
+end
+
+function P.SettingsAudioButton_clicked(e)
+    showGUI("AudioMenu", true)
+end
+
+function P.SettingsResetSettingsButton_clicked(e)
+    -- reset settings
+    debug("event: reset settings")
+end
+
+function P.SettingsBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
Index: code/branches/pickup2/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/pickup2/data/gui/scripts/SingleplayerMenu.lua	(revision 6412)
+++ code/branches/pickup2/data/gui/scripts/SingleplayerMenu.lua	(revision 6412)
@@ -0,0 +1,54 @@
+-- SingleplayerMenu.lua
+
+BasicGUI = require("BasicGUI")
+local P = BasicGUI:new() --inherit everything from the gui package
+if _REQUIREDNAME == nil then
+    SingleplayerMenu = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.filename = "SingleplayerMenu"
+P.layoutString = "SingleplayerMenu.layout"
+
+function P:init()
+    listbox = winMgr:getWindow("orxonox/SingleplayerLevelListbox")
+    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
+
+function P.SingleplayerStartButton_clicked(e)
+    choice = winMgr:getWindow("orxonox/SingleplayerLevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.execute("startGame")
+        hideAllGUIs()
+    end
+end
+
+function P.SingleplayerBackButton_clicked(e)
+    hideGUI(P.filename)
+end
+
+return P
+
