Changeset 6283 for code/branches/presentation2/data/gui
- Timestamp:
- Dec 9, 2009, 1:56:36 PM (15 years ago)
- Location:
- code/branches/presentation2/data/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/layouts/InfoPopup.layout
r6266 r6283 9 9 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 10 10 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 11 <Property Name="Alpha" Value="0. 6" />11 <Property Name="Alpha" Value="0.7" /> 12 12 <Window Type="TaharezLook/Button" Name="orxonox/InfoPopup_close" > 13 13 <Property Name="Font" Value="BlueHighway-12" /> -
code/branches/presentation2/data/gui/scripts/GUITools.lua
r6266 r6283 5 5 end 6 6 7 function openInfoPopup( text, functionPtr)7 function openInfoPopup(text, functionPtr, closeButton) 8 8 showGUI("InfoPopup", false, true) 9 InfoPopup. setDo(functionPtr)9 InfoPopup.execute(functionPtr) 10 10 InfoPopup.setText(text) 11 InfoPopup.setCloseButton(closeButton) 11 12 end -
code/branches/presentation2/data/gui/scripts/InfoPopup.lua
r6266 r6283 15 15 end 16 16 17 function P.setDo(functionPtr) 18 P.functionPtr = functionPtr 19 if P.functionPtr ~= nil then 20 P.functionPtr() 17 function P.execute(functionPtr) 18 if functionPtr ~= nil then 19 functionPtr() 21 20 end 22 21 end … … 24 23 function P.setText( text ) 25 24 winMgr:getWindow("orxonox/InfoPopup_text"):setText( text ) 25 end 26 27 function P.setCloseButton(closeButton) 28 close = winMgr:getWindow("orxonox/InfoPopup_close") 29 close:setVisible(closeButton) 30 if(not closeButton) then 31 close:deactivate(); 32 else 33 close:activate(); 34 end 26 35 end 27 36 -
code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua
r6281 r6283 56 56 57 57 for k,v in pairs(commandList) do 58 local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k) 59 local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 58 60 local button = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Button") 59 local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 60 local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k) 61 local clear = winMgr:createWindow("TaharezLook/Button", "orxonox/KeyBindPane/Binding" .. k .. "/Clear") 61 62 62 63 line:setSize(CEGUI.UVector2(CEGUI.UDim(1,-13),CEGUI.UDim(0, lineHeight))) 64 command:setSize(CEGUI.UVector2(CEGUI.UDim(0.55, 0), CEGUI.UDim(1, 0))) 63 65 button:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(1, 0))) 64 c ommand:setSize(CEGUI.UVector2(CEGUI.UDim(0.6, 0), CEGUI.UDim(1,0)))66 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0.05, 0),CEGUI.UDim(1,0))) 65 67 66 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.6, 0),CEGUI.UDim(0, 0)))68 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1)))) 67 69 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, 0))) 68 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0),CEGUI.UDim(0, lineHeight*(k-1)))) 70 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0.55, 0),CEGUI.UDim(0, 0))) 71 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0.95, 0),CEGUI.UDim(0, 0))) 69 72 73 command:setText(nameList[k]) 70 74 button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(v)) 71 c ommand:setText(nameList[k])72 75 clear:setText("X") 76 73 77 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked") 78 orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked") 74 79 --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked") 75 80 76 81 line:addChildWindow(command) 77 82 line:addChildWindow(button) 83 line:addChildWindow(clear) 78 84 window:addChildWindow(line) 79 85 end … … 83 89 local we = CEGUI.toWindowEventArgs(e) 84 90 local name = we.window:getName() 85 commandNr = tonumber(string.match(name, "%d+"))91 buttonNr = tonumber(string.match(name, "%d+")) 86 92 87 93 openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind) 88 94 end 89 95 96 function P.KeyBindClear_clicked(e) 97 local we = CEGUI.toWindowEventArgs(e) 98 local name = we.window:getName() 99 clearNr = tonumber(string.match(name, "%d+")) 100 101 102 end 103 90 104 function P.keybind() 91 local funct = luaState:createLuaFunctor(" InfoPopup:close()")105 local funct = luaState:createLuaFunctor("KeyBindMenu.callback(" .. buttonNr ..")") 92 106 orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct) 93 orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr]) 107 orxonox.KeyBinderManager:getInstance():keybind(commandList[buttonNr]) 108 end 109 110 function P.callback(number) 111 orxonox.KeyBinderManager:getInstance():registerKeybindCallback(0) 112 local button = winMgr:getWindow("orxonox/KeyBindPane/Binding" .. number .. "/Button") 113 button:setText(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[number])) 114 115 InfoPopup.close() 94 116 end 95 117
Note: See TracChangeset
for help on using the changeset viewer.