Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 22, 2018, 1:03:44 AM (7 years ago)
Author:
landauf
Message:

updated CreditsMenu.lua and SingleplayerMenu.lua to cegui 0.8

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

Legend:

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

    r9016 r11797  
    77function P.onLoad()
    88    P:setButton(1, 1, {
    9             ["button"] = winMgr:getWindow("orxonox/CreditsBackButton"),
     9            ["button"] = P.window:getChild("CreditsBackButton"),
    1010            ["callback"]  = P.CreditsBackButton_clicked
    1111    })
     
    1313
    1414function P.onShow()
    15     local description = winMgr:getWindow("orxonox/CreditsText")
     15    local description = P.window:getChild("CreditsWindow/CreditsMenuWrapper/CreditsMenuPane/CreditsText")
    1616
    1717    height = getStaticTextWindowHeight(description)
    18     description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
     18    description:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
    1919end
    2020
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua

    r8351 r11797  
    5151    local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
    5252    -- Calculate the pixel height of the frame by subtracting the height of the area above from the total height of the window.
    53     local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
     53    local frameHeight = window:getUnclippedOuterRect():get():getHeight() - formattedArea:getHeight()
    5454
    5555    local height = 0
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerMenu.lua

    r11795 r11797  
    2525    --buttons are arranged in a 2x3 matrix
    2626    P:setButton(1, 1, {
    27             ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
     27            ["button"] = P.window:getChild("SingleplayerStartButton"),
    2828            ["callback"]  = P.SingleplayerStartButton_clicked
    2929    })
    3030
    3131    P:setButton(1, 2, {
    32             ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigButton"),
     32            ["button"] = P.window:getChild("SingleplayerConfigButton"),
    3333            ["callback"]  = P.SingleplayerConfigButton_clicked
    3434    })
    3535
    3636    P:setButton(1, 3, {
    37             ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
     37            ["button"] = P.window:getChild("SingleplayerBackButton"),
    3838            ["callback"]  = P.SingleplayerBackButton_clicked
    3939    })
    4040
    4141    P:setButton(2, 2,{
    42             ["button"] = winMgr:getWindow("orxonox/CampaignButton"),
     42            ["button"] = P.window:getChild("CampaignButton"),
    4343            ["callback"] = P.CampaignButton_clicked
    4444    })
     
    5757            local imageName = level:getScreenshot()
    5858            if imageName ~= "" then
    59                 CEGUI.ImagesetManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, imageName)
     59                CEGUI.ImageManager:getSingleton():addFromImageFile(levelXMLFilename..imageName, imageName)
    6060            else
    61                 CEGUI.ImagesetManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
     61                CEGUI.ImageManager:getSingleton():addFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
    6262            end
    6363            table.insert(P.levelList, level)
     
    6969function P.createFilterTab(name, tag)
    7070    -- create unique tab window name
    71     local tabName = "orxonox/SingleplayerLevelTab"
     71    local tabName = "SingleplayerLevelTab"
    7272    if tag ~= nil then
    7373        tabName = tabName..tag
     
    7676    local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
    7777    listbox:setText(name)
    78     listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
    79     listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
     78    listbox:setProperty("MaxSize", "{{1,0},{1,0}}")
     79    listbox:setProperty("Area", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
    8080    -- fill listbox with items
    8181    listbox:resetList()
     
    9898    table.insert(P.activeTabIndexes, tabIndexes)
    9999    -- listen to selection changes
    100     orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".SingleplayerSelectionChanged")
    101     local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl")
    102     orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".SingleplayerSelectionChanged")
     100    orxonox.GUIManager:subscribeEventHelper(listbox, "SelectionChanged", P.name..".SingleplayerSelectionChanged")
     101    local tabControl = P.window:getChild("SingleplayerWindow/SingleplayerTabControl")
     102    orxonox.GUIManager:subscribeEventHelper(tabControl, "SelectionChanged", P.name..".SingleplayerSelectionChanged")
    103103    if listbox:getItemCount() > 0 then
    104         tabControl:addChildWindow(tabName)
     104        tabControl:addChild(listbox)
    105105    end
    106106end
     
    108108function P.SingleplayerGetSelectedLevel()
    109109    -- choose the active listbox
    110     local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/SingleplayerTabControl"))
     110    local tabControl = CEGUI.toTabControl(P.window:getChild("SingleplayerWindow/SingleplayerTabControl"))
    111111    local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex()))
    112112    local choice = listbox:getFirstSelectedItem()
     
    122122
    123123function P.SingleplayerSelectionChanged(e)
    124     local levelImage = winMgr:getWindow("orxonox/SingleplayerLevelImage")
    125     local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription")
    126     local configButton = winMgr:getWindow("orxonox/SingleplayerConfigButton")
     124    local levelImage = P.window:getChild("SingleplayerWindow/SingleplayerLevelImage")
     125    local levelDescription = P.window:getChild("SingleplayerWindow/SingleplayerLevelDescription")
     126    local configButton = P.window:getChild("SingleplayerConfigButton")
    127127    local level = P.SingleplayerGetSelectedLevel()
    128128    if level ~= nil then
     
    130130        local imageName = level:getScreenshot()
    131131        -- set the screenshot and the description for the selected level
    132         levelImage:setProperty("Image", levelXMLFilename..imageName.."/full_image")
     132        levelImage:setProperty("Image", levelXMLFilename..imageName)
    133133        levelDescription:setText(level:getDescription())
    134134        -- only enable config button for "gametype" levels
Note: See TracChangeset for help on using the changeset viewer.