[Orxonox-commit 1574] r6292 - in code/branches/presentation2/data/gui: layouts scripts

cmueri at orxonox.net cmueri at orxonox.net
Wed Dec 9 15:56:03 CET 2009


Author: cmueri
Date: 2009-12-09 15:56:03 +0100 (Wed, 09 Dec 2009)
New Revision: 6292

Modified:
   code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout
   code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout
   code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
Log:
New layout of the keybind menu.

Modified: code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout
===================================================================
--- code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout	2009-12-09 14:55:50 UTC (rev 6291)
+++ code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout	2009-12-09 14:56:03 UTC (rev 6292)
@@ -52,7 +52,7 @@
             <Window Type="TaharezLook/Checkbox" Name="orxonox/FullscreenCheckbox" >
                 <Property Name="Text" Value="Fullscreen" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.4,0},{0.95,0},{0.475,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.4,0},{0.85,0},{0.475,0}}" />
                 <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
             </Window>
             <Window Type="TaharezLook/StaticText" Name="orxonox/GraphicsInfo" >

Modified: code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout
===================================================================
--- code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout	2009-12-09 14:55:50 UTC (rev 6291)
+++ code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout	2009-12-09 14:56:03 UTC (rev 6292)
@@ -1,35 +1,74 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<GUILayout >
-    <Window Type="DefaultWindow" Name="orxonox/KeyBindMenu/Background" >
-        <Property Name="InheritsAlpha" Value="False" />
-        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+
+<GUILayout >
+
+    <Window Type="DefaultWindow" Name="orxonox/KeyBindMenu/Background" >
+
+        <Property Name="InheritsAlpha" Value="False" />
+
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+
         <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindWindow" >
-            <Property Name="Text" Value="KeyBindings" />
-            <Property Name="Alpha" Value="0.8" />
-            <Property Name="InheritsAlpha" Value="False" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
-            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="VertFormatting" Value="TopAligned" />
-            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.325,0},{0.75,0},{0.6,0}}" />
-            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane" >
-                <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
-                <Property Name="HorzStepSize" Value="0.1" />
-                <Property Name="VertStepSize" Value="0.1" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="HorzOverlapSize" Value="0.01" />
-                <Property Name="UnifiedAreaRect" Value="{{0.025,0},{0.15,0},{0.984379,0},{0.95303,0}}" />
-                <Property Name="VertOverlapSize" Value="0.01" />
-                <Property Name="HorzScrollPosition" Value="0" />
-                <Property Name="VertScrollPosition" Value="0" />
-            </Window>
-        </Window>
+
+            <Property Name="Text" Value="Keybindings" />
+
+            <Property Name="Alpha" Value="0.8" />
+
+            <Property Name="InheritsAlpha" Value="False" />
+
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+
+            <Property Name="VertFormatting" Value="TopAligned" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.25,0},{0.8,0},{0.6,0}}" />
+
+            <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindText" >
+                <Property Name="TextColours" Value="FF4444FF" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="HorzFormatting" Value="HorzCentred" />
+                <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.15,0},{0.958333,0},{0.92,0}}" />
+                <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane" >
+
+                    <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
+
+                    <Property Name="HorzStepSize" Value="0.1" />
+
+                    <Property Name="VertStepSize" Value="0.1" />
+
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="HorzOverlapSize" Value="0.01" />
+
+                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.005,0},{0.999,0},{0.99,0}}" />
+
+                    <Property Name="VertOverlapSize" Value="0.01" />
+
+                    <Property Name="HorzScrollPosition" Value="0" />
+
+                    <Property Name="VertScrollPosition" Value="0" />
+
+                </Window>
+
+            </Window>
+        </Window>
+
         <Window Type="TaharezLook/Button" Name="orxonox/KeyBindBackButton" >
-            <Property Name="Text" Value="Back" />
-            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.625,0},{0.6,0},{0.675,0}}" />
-            <Event Name="Clicked" Function="KeyBindMenu.KeyBindBackButton_clicked"/>
-        </Window>
-    </Window>
+
+            <Property Name="Text" Value="Back" />
+
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.625,0},{0.6,0},{0.675,0}}" />
+
+            <Event Name="Clicked" Function="KeyBindMenu.KeyBindBackButton_clicked"/>
+
+        </Window>
+
+    </Window>
+
 </GUILayout>

Modified: code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua	2009-12-09 14:55:50 UTC (rev 6291)
+++ code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua	2009-12-09 14:56:03 UTC (rev 6292)
@@ -1,124 +1,142 @@
--- 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 moveRightLeft")
-    table.insert(commandList, "scale -1 moveRightLeft")
-    table.insert(commandList, "scale 1 moveFrontBack")
-    table.insert(commandList, "boost")
-    table.insert(commandList, "scale -1 moveFrontBack")
-    table.insert(commandList, "scale 1 rotateRoll")
-    table.insert(commandList, "scale -1 rotateRoll")
-    table.insert(commandList, "scale 1 moveUpDown")
-    table.insert(commandList, "scale -1 moveUpDown")
-    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, "Steer Right")
-    table.insert(nameList, "Steer Left")
-    table.insert(nameList, "Give Thrust")
-    table.insert(nameList, "Boost")
-    table.insert(nameList, "Hit Breaks")
-    table.insert(nameList, "Roll Right")
-    table.insert(nameList, "Roll Left")
-    table.insert(nameList, "Up")
-    table.insert(nameList, "Down")
-    table.insert(nameList, "Open Console")
-    table.insert(nameList, "Show Debug")
-    table.insert(nameList, "Show Stats")
-    table.insert(nameList, "mouseLook")
-    table.insert(nameList, "Pause")
-
-    local lineHeight = 30
-    
-    local window = winMgr:getWindow("orxonox/KeyBindPane")
-
-    for k,v in pairs(commandList) do
-        local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
-        local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
-        local button = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Button")
-        local clear = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Clear")
-        
-        line:setSize(CEGUI.UVector2(CEGUI.UDim(1,-13),CEGUI.UDim(0, lineHeight)))
-        command:setSize(CEGUI.UVector2(CEGUI.UDim(0.55, 0), CEGUI.UDim(1, 0)))
-        button:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(1, 0)))
-        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0),CEGUI.UDim(1,0)))
-        
-        line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1))))        
-        command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, 0)))
-        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.55, 0),CEGUI.UDim(0, 0)))
-        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0.95, 0),CEGUI.UDim(0, 0)))
-        
-        command:setText(nameList[k])
-        button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v))
-        clear:setText("X")
-
-        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
-        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
-        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
-        
-        line:addChildWindow(command)
-        line:addChildWindow(button)
-        line:addChildWindow(clear)
-        window:addChildWindow(line)
-    end
-end
-
-function P.KeyBindButton_clicked(e)
-    local we = CEGUI.toWindowEventArgs(e)
-    local name = we.window:getName()
-    buttonNr = tonumber(string.match(name, "%d+"))
-    
-    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind)
-end
-
-function P.KeyBindClear_clicked(e)
-    local we = CEGUI.toWindowEventArgs(e)
-    local name = we.window:getName()
-    clearNr = tonumber(string.match(name, "%d+"))
-    
-    
-end
-
-function P.keybind()
-    local funct = luaState:createLuaFunctor("KeyBindMenu.callback(" .. buttonNr ..")")
-    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
-    orxonox.KeyBinderManager:getInstance():keybind(commandList[buttonNr])
-end
-
-function P.callback(number)
-    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(nil)
-    local button = winMgr:getWindow("orxonox/KeyBindPane/Binding" .. number .. "/Button")
-    button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[number]))
-    
-    InfoPopup.close()
-end
-
-function P.KeyBindBackButton_clicked(e)
-    hideGUI("KeyBindMenu")
-    debug("event: back")
-end
-
-return P
-
+-- 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, "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, "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")
+
+    local lineHeight = 30
+    
+    local window = winMgr:getWindow("orxonox/KeyBindPane")
+
+    for k,v in pairs(commandList) do
+        local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
+        local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
+        local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button")
+        local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear")
+        local button2 = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button2")
+        local clear2 = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear2")
+        local add = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Add")
+        
+        line:setSize(CEGUI.UVector2(CEGUI.UDim(1, -13), CEGUI.UDim(0, lineHeight)))
+        command:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(1, 0)))
+        button:setSize(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0.6, 0)))
+        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0), CEGUI.UDim(0.6, 0)))
+        button2:setSize(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0.6, 0)))
+        clear2:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0), CEGUI.UDim(0.6, 0)))
+        add:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0), CEGUI.UDim(0.6, 0)))
+        
+        line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1))))        
+        command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0.2, 0)))
+        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0.5, 0), CEGUI.UDim(0.2, 0)))
+        button2:setPosition(CEGUI.UVector2(CEGUI.UDim(0.6, 0), CEGUI.UDim(0.2, 0)))
+        clear2:setPosition(CEGUI.UVector2(CEGUI.UDim(0.85, 0), CEGUI.UDim(0.2, 0)))
+        add:setPosition(CEGUI.UVector2(CEGUI.UDim(0.925, 0), CEGUI.UDim(0.2, 0)))
+        
+        command:setText(nameList[k])
+        button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v))
+        clear:setText("X")
+        button2:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v))
+        clear2:setText("X")
+        add:setText("+")
+
+        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
+        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
+        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(add, "Clicked", P.filename .. ".KeyBindAdd_clicked")
+        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
+        
+        line:addChildWindow(command)
+        line:addChildWindow(button)
+        line:addChildWindow(clear)
+        line:addChildWindow(button2)
+        line:addChildWindow(clear2)
+        line:addChildWindow(add)
+        window:addChildWindow(line)
+    end
+end
+
+function P.KeyBindButton_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+    buttonNr = tonumber(string.match(name, "%d+"))
+    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind)
+end
+
+function P.KeyBindClear_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+    clearNr = tonumber(string.match(name, "%d+"))
+end
+
+function P.KeyBindAdd_clicked(e)
+    
+end
+
+function P.keybind()
+    local funct = luaState:createLuaFunctor("KeyBindMenu.callback(" .. buttonNr ..")")
+    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
+    orxonox.KeyBinderManager:getInstance():keybind(commandList[buttonNr])
+end
+
+function P.callback(number)
+    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(nil)
+    local button = winMgr:getWindow("orxonox/KeyBindPane/Binding" .. number .. "/Button")
+    button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[number]))
+    
+    InfoPopup.close()
+end
+
+function P.KeyBindBackButton_clicked(e)
+    hideGUI("KeyBindMenu")
+end
+
+return P
+




More information about the Orxonox-commit mailing list