Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2011, 1:31:12 PM (13 years ago)
Author:
baermatt
Message:

Added screenshots and description-box in singleplayer menu

Location:
code/branches/menue/data/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/menue/data/gui/layouts/CreditsMenu.layout

    r7801 r8912  
    77        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    88        <Window Type="MenuWidgets/StaticText" Name="orxonox/CreditsWindow" >
    9             <Property Name="Text" Value="Keybindings" />
     9            <Property Name="Text" Value="Credits" />
    1010            <Property Name="Alpha" Value="0.8" />
    1111            <Property Name="InheritsAlpha" Value="False" />
     
    1515            <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" />
    1616            <Window Type="MenuWidgets/StaticText" Name="orxonox/CreditsMenuWrapper" >
    17                 <Property Name="TextColours" Value="FF4444FF" />
    1817                <Property Name="InheritsAlpha" Value="False" />
    1918                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     
    2726                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    2827                    <Property Name="HorzOverlapSize" Value="0.01" />
    29                     <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" />
     28                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.997,0},{0.997,0}}" />
    3029                    <Property Name="VertOverlapSize" Value="0.01" />
    3130                    <Property Name="HorzScrollPosition" Value="0" />
     
    3837                        <Property Name="VertFormatting" Value="TopAligned" />
    3938                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    40                         <Property Name="Text">wird sowieso nicht gelesen
    41 Orxonox version 0.0.3
    42 
    43 Programming Language:  C++ - lua - tcl
    44 Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE
    45 Licence:  GNU General Public Licence - Creative Commons
    46 
    47 http://www.orxonox.net
     39                        <Property Name="Text">Orxonox version 0.0.3
     40   
     41    Programming Language:  C++ - lua - tcl
     42    Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE
     43    Licence:  GNU General Public Licence - Creative Commons
     44   
     45    http://www.orxonox.net
     46   
     47    Credits:
    4848                      </Property>
    4949                    </Window>
     
    5959    </Window>
    6060</GUILayout>
    61 
    62 
    63 
    64 
    65 
  • code/branches/menue/data/gui/layouts/SingleplayerMenu.layout

    r8894 r8912  
    1515            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    17             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
     17            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.2,0},{0.8,0},{0.7,0}}" />
    1818            <Window Type="MenuWidgets/TabControl" Name="orxonox/SingleplayerTabControl" >
    1919                <Property Name="TabHeight" Value="{0,26.4388}" />
     
    2222                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
    2323            </Window>
     24            <Window Type="MenuWidgets/StaticImage" Name="orxonox/SingleplayerLevelImage" >
     25                <Property Name="AlwaysOnTop" Value="True" />
     26                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     27                <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.25,0},{0.9,0},{0.7,0}}" />
     28            </Window>
     29            <Window Type="MenuWidgets/StaticText" Name="orxonox/SingleplayerLevelDescriptionWrapper" >
     30                <Property Name="AlwaysOnTop" Value="True" />
     31                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     32                <Property Name="HorzFormatting" Value="HorzCentred" />
     33                <Property Name="VertFormatting" Value="TopAligned" />
     34                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.75,0},{0.9,0},{0.85,0}}" />
     35                <Window Type="MenuWidgets/ScrollablePane" Name="orxonox/SingleplayerLevelDescriptionPane" >
     36                    <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
     37                    <Property Name="HorzStepSize" Value="0.005" />
     38                    <Property Name="VertStepSize" Value="0.005" />
     39                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     40                    <Property Name="HorzOverlapSize" Value="0.01" />
     41                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.997,0},{0.997,0}}" />
     42                    <Property Name="VertOverlapSize" Value="0.01" />
     43                    <Property Name="HorzScrollPosition" Value="0" />
     44                    <Property Name="VertScrollPosition" Value="0" />
     45                    <Window Type="MenuWidgets/StaticText" Name="orxonox/SingleplayerLevelDescription" >
     46                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     47                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
     48                    </Window>
     49                </Window>
     50            </Window>
    2451        </Window>
    2552        <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerStartButton" >
    2653            <Property Name="Text" Value="Start" />
    2754            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    28             <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" />
     55            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.725,0},{0.4,0},{0.775,0}}" />
    2956            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerStartButton_clicked"/>
     57        </Window>
     58        <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerConfigButton" >
     59            <Property Name="Text" Value="Configure" />
     60            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     61            <Property Name="UnifiedAreaRect" Value="{{0.425,0},{0.725,0},{0.575,0},{0.775,0}}" />
     62            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerConfigButton_clicked"/>
    3063        </Window>
    3164        <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerBackButton" >
    3265            <Property Name="Text" Value="Back" />
    3366            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    34             <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />
     67            <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" />
    3568            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/>
    3669        </Window>
  • code/branches/menue/data/gui/scripts/CreditsMenu.lua

    r8079 r8912  
    1414function P.onShow()
    1515    local description = winMgr:getWindow("orxonox/CreditsText")
    16     description:setProperty("HorzFormatting", "WordWrapLeftAligned")
    17     description:setProperty("VertFormatting", "TopAligned")
    18     description:setText("                                   Orxonox version 0.0.3 \n\n       Programming Language:  C++ - lua - tcl \n       Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE \n       Licence:  GNU General Public Licence - Creative Commons \n       http://www.orxonox.net \n \n       Credits:")
    1916
    20     description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    2117    height = getStaticTextWindowHeight(description)
    22     description:setHeight(CEGUI.UDim(0, height))
     18    description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
    2319end
    2420
  • code/branches/menue/data/gui/scripts/SingleplayerMenu.lua

    r8894 r8912  
    44
    55P.levelList = {}
     6P.activeTabIndexes = {}
     7P.scrollbarWidth = 13
    68
    79function P.onLoad()
     
    911   
    1012    -- create tabs with desired tab as argument (nil for all)
    11     P.createFilterTab("Show All", nil)
    1213    P.createFilterTab("Tests", "test")
    1314    P.createFilterTab("Tutorials", "tutorial")
     
    1516    P.createFilterTab("SP?", "singleplayer")
    1617    P.createFilterTab("Presentations", "presentation")
     18    P.createFilterTab("Show All", nil)
    1719
    18     --buttons are arranged in a 1x2 matrix
     20    --buttons are arranged in a 1x3 matrix
    1921    P:setButton(1, 1, {
    2022            ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
     
    2325
    2426    P:setButton(1, 2, {
     27            ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigButton"),
     28            ["callback"]  = P.SingleplayerConfigButton_clicked
     29    })
     30
     31    P:setButton(1, 3, {
    2532            ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
    2633            ["callback"]  = P.SingleplayerBackButton_clicked
     
    3643        level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    3744        if level ~= nil then
     45            local levelXMLFilename = level:getXMLFilename()
     46            local imageName = level:getScreenshot()
     47            if imageName ~= "" then
     48                CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, imageName)
     49            else
     50                CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, "noScreenshot.png")
     51            end
    3852            table.insert(P.levelList, level)
    3953        end
     
    4458function P.createFilterTab(name, tag)
    4559    -- create unique tab window name
    46     local tabName = "orxonox/SingleplayerLevelListbox"
     60    local tabName = "orxonox/SingleplayerLevelTab"
    4761    if tag ~= nil then
    4862        tabName = tabName..tag
     
    5064    -- add new tab window with desired name
    5165    local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl")
    52     local newWindow = winMgr:createWindow("MenuWidgets/Listbox", tabName)
    53     newWindow:setText(name)
    54     newWindow:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
    55     newWindow:setProperty("UnifiedAreaRect", "{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}")
     66    local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
     67    listbox:setText(name)
     68    listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
     69    listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.7,0}}")
    5670    tabControl:addChildWindow(tabName)
    5771    -- fill listbox with items
    58     local listbox = CEGUI.toListbox(newWindow)
    5972    listbox:resetList()
    6073    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
    6174    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
     75    local tabIndexes = {}
    6276    for k,v in pairs(P.levelList) do
    6377        -- only add level if it has desired tag
     
    6680            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    6781            listbox:addItem(item)
     82            table.insert(tabIndexes, k)
    6883            if v:getXMLFilename() == preselect then
    6984                listbox:setItemSelectState(item, true)
     
    7287        end
    7388    end
     89    table.insert(P.activeTabIndexes, tabIndexes)
     90    listbox:subscribeEvent("ItemSelectionChanged", "SingleplayerSelectionChanged")
     91    tabControl:subscribeEvent("TabSelectionChanged", "SingleplayerSelectionChanged")
     92    SingleplayerSelectionChanged()
    7493end
    7594
    76 function P.SingleplayerStartButton_clicked(e)
     95function P.SingleplayerGetSelectedLevel()
    7796    -- choose the active listbox
    7897    local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/SingleplayerTabControl"))
     
    8099    local choice = listbox:getFirstSelectedItem()
    81100    if choice ~= nil then
    82         local index = listbox:getItemIndex(choice)
    83         local level = P.levelList[index+1]
    84         if level ~= nil then
    85             orxonox.execute("startGame " .. level:getXMLFilename())
    86             hideAllMenuSheets()
    87         end
     101        local tabIndexes = P.activeTabIndexes[tabControl:getSelectedTabIndex()+1]
     102        local index = tabIndexes[listbox:getItemIndex(choice)+1]
     103        return P.levelList[index]
     104    else
     105        return nil
    88106    end
     107end
     108
     109function SingleplayerSelectionChanged(e)
     110    local level = P.SingleplayerGetSelectedLevel()
     111    if level ~= nil then
     112        local levelXMLFilename = level:getXMLFilename()
     113        local imageName = level:getScreenshot()
     114        local levelImage = winMgr:getWindow("orxonox/SingleplayerLevelImage")
     115        levelImage:setProperty("Image", "set:"..levelXMLFilename..imageName.." image:full_image")
     116        local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription")
     117        local height = getStaticTextWindowHeight(levelDescription)
     118--        local width = getStaticTextWindowWidth(levelDescription)
     119        levelDescription:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
     120        levelDescription:setText(level:getDescription())
     121    end
     122end
     123
     124function P.SingleplayerStartButton_clicked(e)
     125    local level = P.SingleplayerGetSelectedLevel()
     126    if level ~= nil then
     127        orxonox.execute("startGame " .. level:getXMLFilename())
     128        hideAllMenuSheets()
     129    end
     130end
     131
     132function P.SingleplayerConfigButton_clicked(e)
     133    hideMenuSheet(P.name)
    89134end
    90135
Note: See TracChangeset for help on using the changeset viewer.