Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 24, 2018, 1:05:32 AM (6 years ago)
Author:
landauf
Message:

updated Settings.lua and all sub-menus to cegui 0.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/KeyBindMenu.lua

    r11704 r11800  
    7979
    8080    --Calculate design parameters:
    81     sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/SampleWindow")
     81    sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "KeyBindPane/SampleWindow")
    8282    sampleWindow:setText("SampleText")
    8383
     
    112112
    113113    P:setButton(1, 1, {
    114             ["button"] = winMgr:getWindow("orxonox/KeyBindBackButton"),
     114            ["button"] = P.window:getChild("KeyBindBackButton"),
    115115            ["callback"]  = P.KeyBindBackButton_clicked
    116116    })
     
    137137function P.createLine(k)
    138138    local offset = 0
    139     local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
     139    local line = winMgr:createWindow("DefaultWindow", "Binding" .. k)
    140140    line:setHeight(CEGUI.UDim(0, lineHeight))
    141141    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1))))
    142142
    143     local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
     143    local command = winMgr:createWindow("MenuWidgets/StaticText", "Command")
    144144    command:setText(nameList[k])
    145     command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))
     145    command:setSize(CEGUI.USize(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))
    146146    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
    147     line:addChildWindow(command)
     147    line:addChild(command)
    148148    offset = offset + commandWidth + spaceWidth
    149149
    150     local plus = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus")
    151     plus:setSize(CEGUI.UVector2(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)))
    152152    plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
    153153    plus:setText("add")
    154154    orxonox.GUIManager:subscribeEventHelper(plus, "Clicked", P.name .. ".KeyBindPlus_clicked")
    155     line:addChildWindow(plus)
     155    line:addChild(plus)
    156156    offset = offset + addWidth + spaceWidth
    157157
    158158    local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]);
    159159    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)
    161161        local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)
    162162        name = P.KeyNameNiceifier(name)
     
    165165        local size = getMinTextSize(sampleWindow)
    166166        local buttonWidth = size[2]
    167         button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
     167        button:setSize(CEGUI.USize(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
    168168        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
    169169        orxonox.GUIManager:subscribeEventHelper(button, "Clicked", P.name .. ".KeyBindButton_clicked")
    170170        --button:subscribeScriptedEvent("EventClicked", P.name .. ".KeyBindButton_clicked")
    171         line:addChildWindow(button)
     171        line:addChild(button)
    172172        offset = offset + buttonWidth
    173173
    174         local clear = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)
    175         clear:setSize(CEGUI.UVector2(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)))
    176176        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
    177177        clear:setText("X")
    178178        orxonox.GUIManager:subscribeEventHelper(clear, "Clicked", P.name .. ".KeyBindClear_clicked")
    179         line:addChildWindow(clear)
     179        line:addChild(clear)
    180180        offset = offset + clearWidth + spaceWidth
    181181    end
     
    187187
    188188function P.createLines()
    189     local window = winMgr:getWindow("orxonox/KeyBindPane")
     189    local window = P.window:getChild("KeyBindWindow/KeyBindWrapper/KeyBindPane")
    190190
    191191    for k,v in pairs(commandList) do
    192192        local line = P.createLine(k)
    193193        table.insert(linesList, line)
    194         window:addChildWindow(line)
     194        window:addChild(line)
    195195    end
    196196
     
    201201function P.KeyBindButton_clicked(e)
    202202    local we = CEGUI.toWindowEventArgs(e)
    203     local name = we.window:getName()
     203    local name = we.window:getNamePath()
    204204
    205205    local match = string.gmatch(name, "%d+")
     
    215215function P.KeyBindPlus_clicked(e)
    216216    local we = CEGUI.toWindowEventArgs(e)
    217     local name = we.window:getName()
     217    local name = we.window:getNamePath()
    218218
    219219    local match = string.gmatch(name, "%d+")
     
    227227function P.KeyBindClear_clicked(e)
    228228    local we = CEGUI.toWindowEventArgs(e)
    229     local name = we.window:getName()
     229    local name = we.window:getNamePath()
    230230
    231231    local match = string.gmatch(name, "%d+")
     
    251251
    252252function 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")
    254254    local position = pane:getVerticalScrollPosition()
    255255    while table.getn(linesList) ~= 0 do
    256256        if linesList[1] ~= nil then
    257             winMgr:destroyWindow(linesList[1]:getName())
     257            winMgr:destroyWindow(pane:getChild(linesList[1]:getName()))
    258258        end
    259259        table.remove(linesList, 1)
Note: See TracChangeset for help on using the changeset viewer.