- Timestamp:
- Feb 24, 2018, 1:05:32 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cegui0.8_ogre1.9/data/gui/scripts/KeyBindMenu.lua
r11704 r11800 79 79 80 80 --Calculate design parameters: 81 sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/KeyBindPane/SampleWindow")81 sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "KeyBindPane/SampleWindow") 82 82 sampleWindow:setText("SampleText") 83 83 … … 112 112 113 113 P:setButton(1, 1, { 114 ["button"] = winMgr:getWindow("orxonox/KeyBindBackButton"),114 ["button"] = P.window:getChild("KeyBindBackButton"), 115 115 ["callback"] = P.KeyBindBackButton_clicked 116 116 }) … … 137 137 function P.createLine(k) 138 138 local offset = 0 139 local line = winMgr:createWindow("DefaultWindow", " orxonox/KeyBindPane/Binding" .. k)139 local line = winMgr:createWindow("DefaultWindow", "Binding" .. k) 140 140 line:setHeight(CEGUI.UDim(0, lineHeight)) 141 141 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1)))) 142 142 143 local command = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/KeyBindPane/Binding" .. k .. "/Command")143 local command = winMgr:createWindow("MenuWidgets/StaticText", "Command") 144 144 command:setText(nameList[k]) 145 command:setSize(CEGUI.U Vector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))145 command:setSize(CEGUI.USize(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0))) 146 146 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0))) 147 line:addChild Window(command)147 line:addChild(command) 148 148 offset = offset + commandWidth + spaceWidth 149 149 150 local plus = winMgr:createWindow("MenuWidgets/TabButton", " orxonox/KeyBindPane/Binding" .. k .. "/Plus")151 plus:setSize(CEGUI.U Vector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0)))150 local plus = winMgr:createWindow("MenuWidgets/TabButton", "Plus") 151 plus:setSize(CEGUI.USize(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0))) 152 152 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 153 153 plus:setText("add") 154 154 orxonox.GUIManager:subscribeEventHelper(plus, "Clicked", P.name .. ".KeyBindPlus_clicked") 155 line:addChild Window(plus)155 line:addChild(plus) 156 156 offset = offset + addWidth + spaceWidth 157 157 158 158 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]); 159 159 for i=0,(numButtons-1) do 160 local button = winMgr:createWindow("MenuWidgets/TabButton", " orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)160 local button = winMgr:createWindow("MenuWidgets/TabButton", "Button" .. i) 161 161 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i) 162 162 name = P.KeyNameNiceifier(name) … … 165 165 local size = getMinTextSize(sampleWindow) 166 166 local buttonWidth = size[2] 167 button:setSize(CEGUI.U Vector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))167 button:setSize(CEGUI.USize(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0))) 168 168 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 169 169 orxonox.GUIManager:subscribeEventHelper(button, "Clicked", P.name .. ".KeyBindButton_clicked") 170 170 --button:subscribeScriptedEvent("EventClicked", P.name .. ".KeyBindButton_clicked") 171 line:addChild Window(button)171 line:addChild(button) 172 172 offset = offset + buttonWidth 173 173 174 local clear = winMgr:createWindow("MenuWidgets/TabButton", " orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)175 clear:setSize(CEGUI.U Vector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))174 local clear = winMgr:createWindow("MenuWidgets/TabButton", "Clear" .. i) 175 clear:setSize(CEGUI.USize(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0))) 176 176 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 177 177 clear:setText("X") 178 178 orxonox.GUIManager:subscribeEventHelper(clear, "Clicked", P.name .. ".KeyBindClear_clicked") 179 line:addChild Window(clear)179 line:addChild(clear) 180 180 offset = offset + clearWidth + spaceWidth 181 181 end … … 187 187 188 188 function P.createLines() 189 local window = winMgr:getWindow("orxonox/KeyBindPane")189 local window = P.window:getChild("KeyBindWindow/KeyBindWrapper/KeyBindPane") 190 190 191 191 for k,v in pairs(commandList) do 192 192 local line = P.createLine(k) 193 193 table.insert(linesList, line) 194 window:addChild Window(line)194 window:addChild(line) 195 195 end 196 196 … … 201 201 function P.KeyBindButton_clicked(e) 202 202 local we = CEGUI.toWindowEventArgs(e) 203 local name = we.window:getName ()203 local name = we.window:getNamePath() 204 204 205 205 local match = string.gmatch(name, "%d+") … … 215 215 function P.KeyBindPlus_clicked(e) 216 216 local we = CEGUI.toWindowEventArgs(e) 217 local name = we.window:getName ()217 local name = we.window:getNamePath() 218 218 219 219 local match = string.gmatch(name, "%d+") … … 227 227 function P.KeyBindClear_clicked(e) 228 228 local we = CEGUI.toWindowEventArgs(e) 229 local name = we.window:getName ()229 local name = we.window:getNamePath() 230 230 231 231 local match = string.gmatch(name, "%d+") … … 251 251 252 252 function P.callback() 253 local pane = tolua.cast( winMgr:getWindow("orxonox/KeyBindPane"), "CEGUI::ScrollablePane")253 local pane = tolua.cast(P.window:getChild("KeyBindWindow/KeyBindWrapper/KeyBindPane"), "CEGUI::ScrollablePane") 254 254 local position = pane:getVerticalScrollPosition() 255 255 while table.getn(linesList) ~= 0 do 256 256 if linesList[1] ~= nil then 257 winMgr:destroyWindow( linesList[1]:getName())257 winMgr:destroyWindow(pane:getChild(linesList[1]:getName())) 258 258 end 259 259 table.remove(linesList, 1)
Note: See TracChangeset
for help on using the changeset viewer.