Changeset 6335 for code/branches/presentation2
- Timestamp:
- Dec 13, 2009, 1:46:28 PM (15 years ago)
- Location:
- code/branches/presentation2/data/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/layouts/DecisionPopup.layout
r6334 r6335 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 3 4 5 3 <GUILayout > 6 7 4 <Window Type="DefaultWindow" Name="orxonox/DecisionPopup_RootWindow" > 8 9 5 <Property Name="InheritsAlpha" Value="False" /> 10 11 6 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 12 13 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 14 15 8 <Window Type="TaharezLook/StaticImage" Name="orxonox/DecisionPopup_Background" > 16 17 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 18 9 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" / 19 10 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 20 21 11 <Property Name="Alpha" Value="0.6" /> 22 23 12 <Window Type="TaharezLook/Button" Name="orxonox/DecisionPopup_button_yes" > 24 25 13 <Property Name="Font" Value="BlueHighway-12" /> 26 27 14 <Property Name="Text" Value="Yes" /> 28 29 15 <Property Name="Alpha" Value="0.7" /> 30 31 16 <Property Name="InheritsAlpha" Value="False" /> 32 33 17 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 34 35 18 <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.5625,0},{0.4875,0},{0.6125,0}}" /> 36 37 19 <Event Name="Clicked" Function="DecisionPopup.button_yes"/> 38 39 20 </Window> 40 41 21 <Window Type="TaharezLook/Button" Name="orxonox/DecisionPopup_button_no" > 42 43 22 <Property Name="Font" Value="BlueHighway-12" /> 44 45 23 <Property Name="Text" Value="No" /> 46 47 24 <Property Name="Alpha" Value="0.8" /> 48 49 25 <Property Name="InheritsAlpha" Value="False" /> 50 51 26 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 52 53 27 <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.5625,0},{0.7125,0},{0.6125,0}}" /> 54 55 28 <Event Name="Clicked" Function="DecisionPopup.button_no"/> 56 57 29 </Window> 58 59 30 <Window Type="TaharezLook/StaticText" Name="orxonox/DecisionPopup_text" > 60 61 31 <Property Name="Text" Value="Template text" /> 62 63 32 <Property Name="HorzFormatting" Value="WordWrapCentred" /> 64 65 33 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 66 67 34 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.4375,0},{0.75,0},{0.5375,0}}" /> 68 69 35 <Property Name="InheritsAlpha" Value="False" /> 70 71 36 <Property Name="Alpha" Value="0.8" /> 72 73 37 </Window> 74 75 38 </Window> 76 77 39 </Window> 78 79 40 </GUILayout> -
code/branches/presentation2/data/gui/layouts/InGameMenu.layout
r6334 r6335 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 3 4 5 3 <GUILayout > 6 7 4 <Window Type="DefaultWindow" Name="orxonox/InGameMenu_RootWindow" > 8 9 5 <Property Name="InheritsAlpha" Value="False" /> 10 11 6 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 12 13 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 14 15 8 <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_ReturnButton" > 16 17 9 <Property Name="Font" Value="BlueHighway-12" /> 18 19 10 <Property Name="Text" Value="Return to Game" /> 20 21 11 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 22 23 12 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" /> 24 25 13 <Property Name="Alpha" Value="0.7" /> 26 27 14 <Event Name="Clicked" Function="InGameMenu.button_return_clicked"/> 28 29 15 </Window> 30 31 16 <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_MainMenuButton" > 32 33 17 <Property Name="Font" Value="BlueHighway-12" /> 34 35 18 <Property Name="Text" Value="Main Menu" /> 36 37 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 38 39 20 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4625,0},{0.6,0},{0.5125,0}}" /> 40 41 21 <Property Name="Alpha" Value="0.7" /> 42 43 22 <Event Name="Clicked" Function="InGameMenu.button_mainmenu_clicked"/> 44 45 23 </Window> 46 47 24 <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_SettingsButton" > 48 49 25 <Property Name="Font" Value="BlueHighway-12" /> 50 51 26 <Property Name="Text" Value="Settings" /> 52 53 27 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 54 55 28 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5625,0},{0.6,0},{0.6125,0}}" /> 56 57 29 <Property Name="Alpha" Value="0.7" /> 58 59 30 <Event Name="Clicked" Function="InGameMenu.button_settings_clicked"/> 60 61 31 </Window> 62 63 32 <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_QuitButton" > 64 65 33 <Property Name="Font" Value="BlueHighway-12" /> 66 67 34 <Property Name="Text" Value="Quit" /> 68 69 35 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 70 71 36 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" /> 72 73 37 <Property Name="Alpha" Value="0.7" /> 74 75 38 <Event Name="Clicked" Function="InGameMenu.button_quit_clicked"/> 76 77 39 </Window> 78 79 40 </Window> 80 81 41 </GUILayout> -
code/branches/presentation2/data/gui/layouts/InfoPopup.layout
r6334 r6335 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 3 4 5 3 <GUILayout > 6 7 4 <Window Type="DefaultWindow" Name="orxonox/InfoPopup_RootWindow" > 8 9 5 <Property Name="InheritsAlpha" Value="False" /> 10 11 6 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 12 13 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 14 15 8 <Window Type="TaharezLook/StaticImage" Name="orxonox/InfoPopup_Background" > 16 17 9 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 18 19 10 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 20 21 11 <Property Name="Alpha" Value="0.7" /> 22 23 12 <Window Type="TaharezLook/Button" Name="orxonox/InfoPopup_close" > 24 25 13 <Property Name="Font" Value="BlueHighway-12" /> 26 27 14 <Property Name="Text" Value="Close" /> 28 29 15 <Property Name="Alpha" Value="0.7" /> 30 31 16 <Property Name="InheritsAlpha" Value="False" /> 32 33 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 34 17 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 35 18 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5,0},{0.6,0},{0.55,0}}" /> 36 37 19 <Event Name="Clicked" Function="InfoPopup.close"/> 38 39 20 </Window> 40 41 21 <Window Type="TaharezLook/StaticText" Name="orxonox/InfoPopup_text" > 42 43 22 <Property Name="Text" Value="Template text" /> 44 45 23 <Property Name="TextColours" Value="FF4444FF" /> 46 24 <Property Name="HorzFormatting" Value="WordWrapCentred" /> 47 48 25 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 49 50 26 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.375,0},{0.75,0},{0.475,0}}" /> 51 52 27 <Property Name="InheritsAlpha" Value="False" /> 53 54 28 <Property Name="Alpha" Value="0.8" /> 55 56 29 </Window> 57 58 30 </Window> 59 60 31 </Window> 61 62 32 </GUILayout> -
code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout
r6334 r6335 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 3 4 5 3 <GUILayout > 6 7 4 <Window Type="DefaultWindow" Name="orxonox/KeyBindMenu/Background" > 8 9 5 <Property Name="InheritsAlpha" Value="False" /> 10 11 6 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 12 13 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 14 15 8 <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindWindow" > 16 17 9 <Property Name="Text" Value="Keybindings" /> 18 19 10 <Property Name="Alpha" Value="0.8" /> 20 21 11 <Property Name="InheritsAlpha" Value="False" /> 22 23 12 <Property Name="HorzFormatting" Value="HorzCentred" /> 24 25 13 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 26 27 14 <Property Name="VertFormatting" Value="TopAligned" /> 28 29 15 <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" /> 30 31 16 <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindWrapper" > 32 33 17 <Property Name="TextColours" Value="FF4444FF" /> 34 35 18 <Property Name="InheritsAlpha" Value="False" /> 36 37 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 38 39 20 <Property Name="HorzFormatting" Value="HorzCentred" /> 40 41 21 <Property Name="VertFormatting" Value="TopAligned" /> 42 43 22 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" /> 44 45 23 <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane" > 46 47 24 <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" /> 48 49 25 <Property Name="HorzStepSize" Value="0.1" /> 50 51 26 <Property Name="VertStepSize" Value="0.1" /> 52 53 27 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 54 55 28 <Property Name="HorzOverlapSize" Value="0.01" /> 56 57 29 <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" /> 58 59 30 <Property Name="VertOverlapSize" Value="0.01" /> 60 61 31 <Property Name="HorzScrollPosition" Value="0" /> 62 63 32 <Property Name="VertScrollPosition" Value="0" /> 64 65 33 </Window> 66 67 34 </Window> 68 69 35 </Window> 70 71 36 <Window Type="TaharezLook/Button" Name="orxonox/KeyBindBackButton" > 72 37 <Property Name="Text" Value="Back" /> 73 74 38 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 75 76 39 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" /> 77 78 40 <Event Name="Clicked" Function="KeyBindMenu.KeyBindBackButton_clicked"/> 79 80 41 </Window> 81 82 42 </Window> 83 84 43 </GUILayout> -
code/branches/presentation2/data/gui/scripts/InfoPopup.lua
r6334 r6335 1 1 -- InfoPopup.lua 2 3 4 2 5 3 BasicGUI = require("BasicGUI") 6 4 local P = BasicGUI:new() --inherit everything from the gui package 7 5 8 9 6 if _REQUIREDNAME == nil then 10 11 7 InfoPopup = P 12 13 8 else 14 15 9 _G[_REQUIREDNAME] = P 16 17 10 end 18 11 19 20 21 12 P.filename = "InfoPopup" 22 23 13 P.layoutString = "InfoPopup.layout" 24 14 25 26 27 15 function P:init() 28 29 16 end 30 17 31 32 33 18 function P.execute(functionPtr, arguments) 34 35 19 if functionPtr ~= nil then 36 37 20 if arguments ~= nil then 38 39 21 functionPtr(arguments) 40 41 22 else 42 43 23 functionPtr() 44 45 24 end 46 47 25 end 48 49 26 end 50 27 51 52 53 28 function P.setText( text ) 54 55 29 winMgr:getWindow("orxonox/InfoPopup_text"):setText( text ) 56 57 30 end 58 31 59 60 61 32 function P.setCloseButton(closeButton) 62 63 33 close = winMgr:getWindow("orxonox/InfoPopup_close") 64 65 34 close:setVisible(closeButton) 66 67 35 if(not closeButton) then 68 69 36 close:deactivate(); 70 71 37 else 72 73 38 close:activate(); 74 75 39 end 76 77 40 end 78 41 79 80 81 42 -- events for ingamemenu 82 83 84 43 function P.close(e) 85 86 44 hideGUI("InfoPopup") 87 88 45 end 89 46 90 91 92 47 return P 93 -
code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
r6334 r6335 1 1 -- KeyBindMenu.lua 2 2 3 4 5 3 BasicGUI = require("BasicGUI") 6 7 4 local P = BasicGUI:new() --inherit everything from the gui package 8 5 9 10 6 if _REQUIREDNAME == nil then 11 12 7 KeyBindMenu = P 13 14 8 else 15 9 _G[_REQUIREDNAME] = P 16 17 end 18 19 10 end 20 11 21 12 P.filename = "KeyBindMenu" 22 23 13 P.layoutString = "KeyBindMenu.layout" 24 14 25 26 27 15 function P:init() 28 16 29 17 commandList = {} 30 31 18 table.insert(commandList, "fire 0") 32 33 19 table.insert(commandList, "fire 1 | unfire") 34 35 20 table.insert(commandList, "onpress fire 2") 36 37 21 table.insert(commandList, "scale 1 moveFrontBack") 38 39 22 table.insert(commandList, "scale -1 moveFrontBack") 40 41 23 table.insert(commandList, "boost") 42 43 24 table.insert(commandList, "scale 1 moveRightLeft") 44 45 25 table.insert(commandList, "scale -1 moveRightLeft") 46 47 26 table.insert(commandList, "scale 1 moveUpDown") 48 49 27 table.insert(commandList, "scale -1 moveUpDown") 50 51 28 table.insert(commandList, "scale 1 rotateRoll") 52 53 29 table.insert(commandList, "scale -1 rotateRoll") 54 55 30 table.insert(commandList, "switchCamera") 56 57 31 table.insert(commandList, "openConsole") 58 59 32 table.insert(commandList, "OverlayGroup toggleVisibility Debug") 60 61 33 table.insert(commandList, "OverlayGroup toggleVisibility Stats") 62 63 34 table.insert(commandList, "mouseLook") 64 65 35 table.insert(commandList, "pause") 66 36 67 68 69 37 nameList = {} 70 71 38 table.insert(nameList, "Primary Fire") 72 73 39 table.insert(nameList, "Secondary Fire") 74 75 40 table.insert(nameList, "Fire Rocket") 76 77 41 table.insert(nameList, "Accelerate") 78 79 42 table.insert(nameList, "Break") 80 43 table.insert(nameList, "Boost") 81 82 44 table.insert(nameList, "Move Right") 83 84 45 table.insert(nameList, "Move Left") 85 86 46 table.insert(nameList, "Move Up") 87 88 47 table.insert(nameList, "Move Down") 89 90 48 table.insert(nameList, "Roll Right") 91 92 49 table.insert(nameList, "Roll Left") 93 94 50 table.insert(nameList, "Switch Camera") 95 96 51 table.insert(nameList, "Open Console") 97 98 52 table.insert(nameList, "Show Debug") 99 100 53 table.insert(nameList, "Show Stats") 101 102 54 table.insert(nameList, "Look Around") 103 104 55 table.insert(nameList, "Pause") 105 56 106 107 108 57 linesList = {} 109 58 110 111 lineHeight = 25 59 lineHeight = 30 112 60 commandWidth = 125 113 buttonWidth = 1 2561 buttonWidth = 145 114 62 clearWidth = 20 115 addWidth = 25 116 63 addWidth = 30 117 64 spaceWidth = 10 118 65 119 120 121 66 P.createLines() 122 67 123 124 125 68 local funct = luaState:createLuaFunctor("KeyBindMenu.callback()") 126 127 69 orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct) 128 129 end 130 131 132 70 end 133 71 134 72 function P.KeyNameNiceifier(key) 135 136 73 local name = string.sub(key, string.find(key, '%.(.*)')+1) 137 74 local group = string.sub(key, string.find(key, '(.*)%.')) 138 139 75 group = string.sub(group,1,string.len(group)-1) 140 141 76 if( group == "Keys") then 142 143 77 return "Key " .. string.sub(name, string.find(name, 'Key(.*)')+3) 144 145 78 elseif( group == "MouseButtons") then 146 147 79 return "Mouse " .. name 148 149 end 150 80 end 151 81 return key 152 153 end 154 155 82 end 156 83 157 84 function P.createLine(k) 158 159 85 local offset = 0 160 161 86 local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k) 162 163 87 line:setHeight(CEGUI.UDim(0, lineHeight)) 164 165 88 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1)))) 166 89 167 168 169 90 local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 170 171 91 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0))) 172 173 92 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0))) 174 175 93 command:setText(nameList[k]) 176 94 line:addChildWindow(command) 177 178 95 offset = offset + commandWidth + spaceWidth 179 96 97 local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus") 98 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0))) 99 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 100 plus:setText("add") 101 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked") 102 line:addChildWindow(plus) 103 offset = offset + addWidth + spaceWidth 104 105 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]); 106 for i=0,(numButtons-1) do 107 local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i) 108 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0))) 109 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 110 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i) 111 name = P.KeyNameNiceifier(name) 112 button:setText(name) 113 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked") 114 --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked") 115 line:addChildWindow(button) 116 offset = offset + buttonWidth 117 118 local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i) 119 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0))) 120 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth+spaceWidth)+buttonWidth)+commandWidth+clearWidth+2*spaceWidth), CEGUI.UDim(0.15, 0))) 121 clear:setText("X") 122 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked") 123 line:addChildWindow(clear) 124 offset = offset + clearWidth + spaceWidth 125 end 180 126 181 182 local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus") 183 184 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0))) 185 186 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 187 188 plus:setText("add") 189 190 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked") 191 192 line:addChildWindow(plus) 193 194 offset = offset + addWidth + spaceWidth 195 127 debug(0, "OFFSET: " .. offset) 128 129 line:setWidth(CEGUI.UDim(0, offset+clearWidth)) 196 130 197 198 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]);199 200 for i=0,(numButtons-1) do201 202 local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)203 204 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))205 206 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))207 208 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)209 210 name = P.KeyNameNiceifier(name)211 212 button:setText(name)213 214 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")215 216 --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")217 218 line:addChildWindow(button)219 220 offset = offset + buttonWidth221 222 223 224 local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)225 226 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))227 228 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth+spaceWidth)+buttonWidth)+commandWidth+clearWidth+2*spaceWidth), CEGUI.UDim(0.15, 0)))229 230 clear:setText("X")231 232 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")233 234 line:addChildWindow(clear)235 236 offset = offset + clearWidth + spaceWidth237 238 end239 240 241 242 line:setWidth(CEGUI.UDim(0, offset+clearWidth))243 244 245 246 131 return line 247 248 end 249 250 132 end 251 133 252 134 function P.createLines() 253 254 255 135 local window = winMgr:getWindow("orxonox/KeyBindPane") 256 136 257 258 137 for k,v in pairs(commandList) do 259 260 138 local line = P.createLine(k) 261 262 139 table.insert(linesList, line) 263 264 140 window:addChildWindow(line) 265 266 end 267 268 269 end 270 271 141 end 142 end 272 143 273 144 function P.KeyBindButton_clicked(e) 274 275 145 local we = CEGUI.toWindowEventArgs(e) 276 277 146 local name = we.window:getName() 278 147 279 280 148 local match = string.gmatch(name, "%d+") 281 282 149 local commandNr = tonumber(match()) 283 284 150 local buttonNr = tonumber(match()) 285 151 286 287 288 152 local arguments = {} 289 290 153 arguments[1] = commandNr 291 292 154 arguments[2] = buttonNr 293 294 155 openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments) 295 156 end 296 157 297 158 function P.KeyBindPlus_clicked(e) 298 299 159 local we = CEGUI.toWindowEventArgs(e) 300 301 160 local name = we.window:getName() 302 161 303 304 305 162 local match = string.gmatch(name, "%d+") 306 307 163 local commandNr = tonumber(match()) 308 309 164 310 165 local arguments = {} 311 312 166 arguments[1] = commandNr 313 314 167 openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments) 315 168 end 316 169 317 170 function P.KeyBindClear_clicked(e) 318 319 171 local we = CEGUI.toWindowEventArgs(e) 320 321 172 local name = we.window:getName() 322 173 323 324 325 174 local match = string.gmatch(name, "%d+") 326 327 175 local commandNr = tonumber(match()) 328 329 176 local buttonNr = tonumber(match()) 330 331 177 332 178 orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr)) 333 179 334 335 336 180 P.callback() 337 338 end 339 340 181 end 341 182 342 183 function P.keybind(arguments) 343 344 184 local commandNr = arguments[1] 345 346 185 local buttonNr = arguments[2] 347 348 186 if buttonNr ~= nil then 349 350 187 orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr)) 351 352 end 353 188 end 354 189 355 190 orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr]) 356 357 end 358 359 191 end 360 192 361 193 function P.callback() 362 363 194 while table.getn(linesList) ~= 0 do 364 365 195 if linesList[1] ~= nil then 366 367 196 winMgr:destroyWindow(linesList[1]:getName()) 368 369 197 end 370 371 198 table.remove(linesList, 1) 372 373 end 374 375 199 end 376 200 377 201 linesList = {} 378 202 379 380 203 P.createLines() 381 382 204 if(InfoPopup ~= nil) then 383 384 205 InfoPopup.close() 385 386 end 387 388 end 389 390 206 end 207 end 391 208 392 209 function P.KeyBindBackButton_clicked(e) 393 394 210 hideGUI("KeyBindMenu") 395 396 end 397 398 211 end 399 212 400 213 return P 401
Note: See TracChangeset
for help on using the changeset viewer.