Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 23, 2018, 12:20:35 AM (7 years ago)
Author:
landauf
Message:

updated HostMenu.lua, MultiplayerMenu.lua, ShipSelectionMenu.lua, SingleplayerConfigMenu.lua to cegui 0.8

Location:
code/branches/cegui0.8_ogre1.9/data/gui
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cegui0.8_ogre1.9/data/gui/layouts/HostMenu.layout

    r11793 r11799  
    3535                <Property name="MaxSize" value="{{1,0},{1,0}}" />
    3636                <Property name="Area" value="{{0.8,0},{0.87,0},{1,0},{.97,0}}" />
    37                 <Event function="HostMenu.MultiplayerShowAll_clicked" name="CheckStateChanged" />
     37                <Event function="HostMenu.MultiplayerShowAll_clicked" name="SelectStateChanged" />
    3838            </Window>
    3939        </Window>
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua

    r11797 r11799  
    3131
    3232    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
    33     local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
    34     local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
     33    local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():get():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
     34    local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():get():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
    3535
    3636    table.insert(size, height)
     
    4040
    4141function getScrollingStepSize(window)
    42     local height = window:getUnclippedOuterRect():getHeight()
    43     local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedOuterRect():getHeight()
     42    local height = window:getUnclippedOuterRect():get():getHeight()
     43    local maxHeight = window:getRootWindow():getUnclippedOuterRect():get():getHeight()
    4444    local ratio = height/maxHeight
    4545    return 0.008*ratio/0.3204
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/HostMenu.lua

    r11795 r11799  
    1111function P.onLoad()
    1212    P.multiplayerMode = "startServer"
    13     local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
    14     local button = tolua.cast(window,"CEGUI::Checkbox")
     13    local window = P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox")
     14    local button = tolua.cast(window,"CEGUI::ToggleButton")
    1515    button:setSelected(false)
    1616    P.createLevelList()
    1717
    1818    P:setButton(1, 1, {
    19             ["button"] = winMgr:getWindow("orxonox/HostMenuStartButton"),
     19            ["button"] = P.window:getChild("HostMenuStartButton"),
    2020            ["callback"]  = P.HostMenuStartButton_clicked
    2121    })
    2222
    2323    P:setButton(1, 2, {
    24             ["button"] = winMgr:getWindow("orxonox/HostMenuBackButton"),
     24            ["button"] = P.window:getChild("HostMenuBackButton"),
    2525            ["callback"]  = P.HostMenuBackButton_clicked
    2626    })
     
    2929function P.onShow()
    3030    if P.showAll ~= orxonox.GUIManager:inDevMode() then
    31         local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
    32         local button = tolua.cast(window,"CEGUI::Checkbox")
     31        local window = P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox")
     32        local button = tolua.cast(window,"CEGUI::ToggleButton")
    3333        P.showAll = not P.showAll
    3434        button:setSelected(P.showAll)
     
    3636
    3737    if P.multiplayerMode == "startServer" then
    38         local window = winMgr:getWindow("orxonox/HostMenuHostButton")
     38        local window = P.window:getChild("HostMenuWindow/HostMenuHostButton")
    3939        local button = tolua.cast(window,"CEGUI::RadioButton")
    4040        button:setSelected(true)
     
    4343
    4444    if P.multiplayerMode == "startDedicated" then
    45         local window = winMgr:getWindow("orxonox/HostMenuDedicatedButton")
     45        local window = P.window:getChild("HostMenuWindow/HostMenuDedicatedButton")
    4646        local button = tolua.cast(window,"CEGUI::RadioButton")
    4747        button:setSelected(true)
     
    5353    P.levelList = {}
    5454    P.itemList = {}
    55     local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox"))
     55    local listbox = CEGUI.toListbox(P.window:getChild("HostMenuWindow/HostMenuListbox"))
    5656    listbox:resetList()
    5757    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
     
    9898
    9999function P.HostMenuStartButton_clicked(e)
    100     local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox"))
     100    local listbox = CEGUI.toListbox(P.window:getChild("HostMenuWindow/HostMenuListbox"))
    101101    local choice = listbox:getFirstSelectedItem()
    102102    if choice ~= nil then
     
    111111
    112112function P.MultiplayerShowAll_clicked(e)
    113     local checkbox = tolua.cast(winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox"), "CEGUI::Checkbox")
     113    local checkbox = tolua.cast(P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox"), "CEGUI::ToggleButton")
    114114    local show = checkbox:isSelected()
    115115    if show ~= P.showAll then
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/MultiplayerMenu.lua

    r11795 r11799  
    1212    --button are arranged in a 3x2 matrix, Join and Host buttons are in the upper left and middle, the back button in the lower right of the table
    1313    P:setButton(1, 1, {
    14             ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton"),
     14            ["button"] = P.window:getChild("MultiplayerJoinButton"),
    1515            ["callback"]  = P.MultiplayerJoinButton_clicked
    1616    })
    1717
    1818    P:setButton(1, 2, {
    19             ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton"),
     19            ["button"] = P.window:getChild("MultiplayerHostButton"),
    2020            ["callback"]  = P.MultiplayerHostButton_clicked
    2121    })
    2222
    2323    P:setButton(2, 3, {
    24             ["button"] = winMgr:getWindow("orxonox/MultiplayerBackButton"),
     24            ["button"] = P.window:getChild("MultiplayerBackButton"),
    2525            ["callback"]  = P.MultiplayerBackButton_clicked
    2626    })
     
    3131
    3232    if P.joinMode == 1 then
    33         local window = winMgr:getWindow("orxonox/MultiplayerLanButton")
     33        local window = P.window:getChild("MultiplayerWindow/MultiplayerLanButton")
    3434        local button = tolua.cast(window,"CEGUI::RadioButton")
    3535        button:setSelected(true)
    3636    end
    3737    if P.joinMode == 2 then
    38         local window = winMgr:getWindow("orxonox/MultiplayerInternetButton")
     38        local window = P.window:getChild("MultiplayerWindow/MultiplayerInternetButton")
    3939        local button = tolua.cast(window,"CEGUI::RadioButton")
    4040        button:setSelected(true)
     
    6666
    6767function P.MultiplayerJoinButton_clicked(e)
    68     local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem()
     68    local choice = P.window:getChild("MultiplayerWindow/MultiplayerListbox"):getFirstSelectedItem()
    6969    local destination = nil
    7070    if choice then
     
    8585    -- LAN Discovery
    8686    if P.joinMode == 1 then
    87         local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     87        local listbox = P.window:getChild("MultiplayerWindow/MultiplayerListbox")
    8888        CEGUI.toListbox(listbox):resetList()
    8989        local discovery = orxonox.LANDiscovery:getInstance()
     
    120120    -- WAN Discovery
    121121    elseif P.joinMode == 2 then
    122         local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
     122        local listbox = P.window:getChild("MultiplayerWindow/MultiplayerListbox")
    123123        CEGUI.toListbox(listbox):resetList()
    124124        local discovery = orxonox.WANDiscovery()
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/ShipSelectionMenu.lua

    r11795 r11799  
    4444
    4545function P.createFilterTab(name) -- generates filter tab and list box, sets handler for selection changes
    46     tabName = "orxonox/ShipSelectionLevelTab"
     46    tabName = "ShipSelectionLevelTab"
    4747    -- create new tab window with desired name
    4848    listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
    4949    listbox:setText(name)
    50     listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
     50    listbox:setProperty("MaxSize", "{{1,0},{1,0}}")
    5151    --[[TODO: smaller list if image and description is implemented.
    52     listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]]
    53     listbox:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")
     52    listbox:setProperty("Area", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]]
     53    listbox:setProperty("Area", "{{0,0},{0,0},{1,0},{1,0}}")
    5454    -- fill listbox with items
    5555    P.update()
    5656    -- listen to selection changes
    57     orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".ShipSelectionSelectionChanged")
    58     local tabControl = winMgr:getWindow("orxonox/ShipSelectionTabControl")
    59     orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".ShipSelectionSelectionChanged")
     57    orxonox.GUIManager:subscribeEventHelper(listbox, "SelectionChanged", P.name..".ShipSelectionSelectionChanged")
     58    local tabControl = P.window:getChild("ShipSelectionWindow/ShipSelectionTabControl")
     59    orxonox.GUIManager:subscribeEventHelper(tabControl, "SelectionChanged", P.name..".ShipSelectionSelectionChanged")
    6060    if listbox:getItemCount() > 0 then
    61         tabControl:addChildWindow(tabName)
     61        tabControl:addChild(listbox)
    6262    end
    6363end
     
    6565function P.ShipSelectionGetSelectedModel() --returns selected model, if available.
    6666    -- choose the active listbox
    67     local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/ShipSelectionTabControl"))
     67    local tabControl = CEGUI.toTabControl(P.window:getChild("ShipSelectionWindow/ShipSelectionTabControl"))
    6868    local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex()))
    6969    local choice = listbox:getFirstSelectedItem()
     
    8080function P.ShipSelectionSelectionChanged(e)
    8181    --[[ TODO: Get image and description from template file
    82     local levelImage = winMgr:getWindow("orxonox/ShipSelectionLevelImage")
    83     local levelDescription = winMgr:getWindow("orxonox/ShipSelectionLevelDescription")
    84     local configButton = winMgr:getWindow("orxonox/ShipSelectionConfigButton")
     82    local levelImage = P.window:getChild("orxonox/ShipSelectionLevelImage")
     83    local levelDescription = P.window:getChild("orxonox/ShipSelectionLevelDescription")
     84    local configButton = P.window:getChild("orxonox/ShipSelectionConfigButton")
    8585    local level = P.ShipSelectionGetSelectedModel()
    8686    if level ~= nil then
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerConfigMenu.lua

    r9665 r11799  
    1616
    1717function P.onLoad()
    18     P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/SampleWindow")
     18    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "ConfigWindow/Wrapper/MiscConfigPane/SampleWindow")
    1919    P.sampleWindow:setText("SampleText")
    2020
    2121    P:setButton(1, 1, {
    22             ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/CancelButton"),
     22            ["button"] = P.window:getChild("CancelButton"),
    2323            ["callback"]  = P.SingleplayerConfigCancelButton_clicked
    2424    })
    2525   
    2626    P:setButton(1, 2, {
    27             ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/OKButton"),
     27            ["button"] = P.window:getChild("OKButton"),
    2828            ["callback"]  = P.SingleplayerConfigOKButton_clicked
    2929    })
     
    8888    P.spaceWidth = 10
    8989   
    90     local pane = tolua.cast(winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane")
     90    local pane = tolua.cast(P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane"), "CEGUI::ScrollablePane")
    9191    size = pane:getViewableArea()
    9292    P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth
     
    9898    local offset = 0
    9999    -- destroy config line, if it already exists (otherwise would cause an error)
    100     if winMgr:isWindowPresent("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) then
    101         winMgr:destroyWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)
     100    local oldLine = P.window:getChildRecursive("ConfigCommand" .. k)
     101    if oldLine ~= nil then
     102        winMgr:destroyWindow(oldLine)
    102103    end
    103104    -- content window for the entire line
    104     local line = winMgr:createWindow("DefaultWindow", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)
     105    local line = winMgr:createWindow("DefaultWindow", "ConfigCommand" .. k)
    105106    line:setHeight(CEGUI.UDim(0, P.lineHeight))
    106107    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
    107108
    108109    -- config name
    109     local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")
     110    local command = winMgr:createWindow("MenuWidgets/StaticText", "Command")
    110111    command:setText(P.nameList[k])
    111     command:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
     112    command:setSize(CEGUI.USize(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
    112113    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
    113     line:addChildWindow(command)
     114    line:addChild(command)
    114115    offset = offset + P.commandWidth + P.spaceWidth
    115116
    116117    -- config value (editable)
    117     local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
     118    local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "Configvalue")
    118119    configvalue:setProperty("ReadOnly", "set:False")
    119120    local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])
    120121    configvalue:setText(value)
    121     configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))
     122    configvalue:setSize(CEGUI.USize(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))
    122123    configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
    123124    -- enable the reset button if the value changed
    124125    orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".SingleplayerConfigEditbox_textAccepted")
    125     line:addChildWindow(configvalue)
     126    line:addChild(configvalue)
    126127    offset = offset + P.editboxWidth + P.spaceWidth
    127128
    128129    -- reset button (only available when value changed)
    129     local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
    130     reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
     130    local reset = winMgr:createWindow("MenuWidgets/Button", "Reset")
     131    reset:setSize(CEGUI.USize(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
    131132    reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
    132133    reset:setText("reset")
    133134    orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".SingleplayerConfigResetButton_clicked")
    134     line:addChildWindow(reset)
     135    line:addChild(reset)
    135136    reset:setEnabled(false)
    136137    offset = offset + P.resetWidth + P.spaceWidth
     
    142143
    143144function P.createLines()
    144     local window = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane")
     145    local window = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane")
    145146
    146147    for k,v in pairs(P.commandList) do
    147148        local line = P.createLine(k)
    148149        table.insert(P.linesList, line)
    149         window:addChildWindow(line)
     150        window:addChild(line)
    150151    end
    151152
     
    157158    for k,v in pairs(P.commandList) do
    158159        -- save the changes
    159         local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
     160        local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
    160161        orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText())
    161         local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
     162        local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
    162163        resetButton:setEnabled(false)
    163164    end
     
    172173function P.SingleplayerConfigEditbox_textAccepted(e)
    173174    local we = CEGUI.toWindowEventArgs(e)
    174     local name = we.window:getName()
     175    local name = we.window:getNamePath()
    175176
    176177    local match = string.gmatch(name, "%d+")
    177178    local commandNr = tonumber(match())
    178179
    179     local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
     180    local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
    180181    resetButton:setEnabled(true)
    181182end
     
    183184function P.SingleplayerConfigResetButton_clicked(e)
    184185    local we = CEGUI.toWindowEventArgs(e)
    185     local name = we.window:getName()
     186    local name = we.window:getNamePath()
    186187
    187188    local match = string.gmatch(name, "%d+")
     
    189190
    190191    -- reload the old value
    191     local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
     192    local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
    192193    local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr])
    193194    editbox:setText(value)
Note: See TracChangeset for help on using the changeset viewer.