Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2011, 5:31:27 PM (14 years ago)
Author:
landauf
Message:

added new graphics menu

Location:
code/branches/usability/data
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/layouts/GraphicsMenu.layout

    r7801 r8018  
    1515            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    17             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2,0},{0.75,0},{0.6375,0}}" />
    18             <Window Type="MenuWidgets/StaticText" Name="orxonox/Resolution" >
    19                 <Property Name="Text" Value="Resolution" />
    20                 <Property Name="InheritsAlpha" Value="False" />
    21                 <Property Name="HorzFormatting" Value="HorzCentred" />
     17            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.15,0},{0.75,0},{0.6375,0}}" />
     18            <Window Type="MenuWidgets/TabControl" Name="orxonox/GraphicsTabControl" >
     19                <Property Name="TabHeight" Value="{0,26.4388}" />
    2220                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    23                 <Property Name="VertFormatting" Value="TopAligned" />
    24                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.10,0},{0.475,0},{0.65,0}}" />
    25                 <Window Type="MenuWidgets/Listbox" Name="orxonox/ResolutionListbox" >
     21                <Property Name="TabPanePosition" Value="Top" />
     22                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
     23                <Window Type="DefaultWindow" Name="orxonox/Display" >
     24                    <Property Name="Text" Value="Display" />
    2625                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    27                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.2,0},{0.95,0},{0.95,0}}" />
    28                     <Event Name="ItemSelectionChanged" Function="GraphicsMenu.GraphicsResolutionListbox_changed"/>
     26                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
     27                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Resolution" >
     28                        <Property Name="Text" Value="Resolution" />
     29                        <Property Name="HorzFormatting" Value="HorzCentred" />
     30                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     31                        <Property Name="VertFormatting" Value="TopAligned" />
     32                        <Property Name="UnifiedAreaRect" Value="{{0.025,0},{0.035,0},{0.4875,0},{0.96,0}}" />
     33                        <Window Type="MenuWidgets/Checkbox" Name="orxonox/Display/Resolution/Fullscreen" >
     34                            <Property Name="Text" Value="Fullscreen" />
     35                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     36                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.27,0}}" />
     37                            <Event Name="CheckStateChanged" Function="GraphicsMenu.callback_FullscreenCheckbox_CheckStateChanged" />
     38                        </Window>
     39                        <Window Type="MenuWidgets/Combobox" Name="orxonox/Display/Resolution/Combobox" >
     40                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     41                            <Property Name="ClippedByParent" Value="False" />
     42                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.3,0},{0.95,0},{1.2,0}}" />
     43                            <Property Name="MaxEditTextLength" Value="1073741823" />
     44                            <Event Name="ListSelectionAccepted" Function="GraphicsMenu.callback_ResolutionCombobox_ListSelectionAccepted" />
     45                        </Window>
     46                        <Window Type="MenuWidgets/Editbox" Name="orxonox/Display/Resolution/EditboxWidth" >
     47                            <Property Name="MaxTextLength" Value="1073741823" />
     48                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     49                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.45,0},{0.45,0},{0.57,0}}" />
     50                            <Event Name="TextChanged" Function="GraphicsMenu.callback_ResolutionEditboxWidth_TextChanged" />
     51                        </Window>
     52                        <Window Type="MenuWidgets/Editbox" Name="orxonox/Display/Resolution/EditboxHeight" >
     53                            <Property Name="MaxTextLength" Value="1073741823" />
     54                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     55                            <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.45,0},{0.95,0},{0.57,0}}" />
     56                            <Event Name="TextChanged" Function="GraphicsMenu.callback_ResolutionEditboxHeight_TextChanged" />
     57                        </Window>
     58                        <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Resolution/x" >
     59                            <Property Name="Text" Value="x" />
     60                            <Property Name="FrameEnabled" Value="False" />
     61                            <Property Name="HorzFormatting" Value="HorzCentred" />
     62                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     63                            <Property Name="UnifiedAreaRect" Value="{{0.45,0},{0.45,0},{0.55,0},{0.57,0}}" />
     64                            <Property Name="BackgroundEnabled" Value="False" />
     65                        </Window>
     66                        <Window Type="MenuWidgets/Button" Name="orxonox/Display/Resolution/Apply" >
     67                            <Property Name="Text" Value="Apply" />
     68                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     69                            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.61,0},{0.75,0},{0.73,0}}" />
     70                            <Event Name="Clicked" Function="GraphicsMenu.callback_Apply_Clicked" />
     71                        </Window>
     72                        <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Resolution/AspectRatioLabel" >
     73                            <Property Name="Text" Value="Aspect Ratio" />
     74                            <Property Name="FrameEnabled" Value="False" />
     75                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     76                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.825,0},{0.6,0},{0.95,0}}" />
     77                            <Property Name="BackgroundEnabled" Value="False" />
     78                        </Window>
     79                        <Window Type="MenuWidgets/Editbox" Name="orxonox/Display/Resolution/AspectRatio" >
     80                            <Property Name="Text" Value="1" />
     81                            <Property Name="MaxTextLength" Value="1073741823" />
     82                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     83                            <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.825,0},{0.95,0},{0.95,0}}" />
     84                        </Window>
     85                    </Window>
     86                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Theme" >
     87                        <Property Name="Text" Value="Theme" />
     88                        <Property Name="HorzFormatting" Value="HorzCentred" />
     89                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     90                        <Property Name="VertFormatting" Value="TopAligned" />
     91                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.035,0},{0.975,0},{0.32,0}}" />
     92                        <Window Type="MenuWidgets/Combobox" Name="orxonox/Display/Theme/Combobox" >
     93                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     94                            <Property Name="ClippedByParent" Value="False" />
     95                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.5,0},{0.95,0},{1.6,0}}" />
     96                            <Property Name="MaxEditTextLength" Value="1073741823" />
     97                            <Event Name="ListSelectionAccepted" Function="GraphicsMenu.callback_ThemeCombobox_ListSelectionAccepted" />
     98                        </Window>
     99                    </Window>
     100                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/More" >
     101                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     102                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.37,0},{0.975,0},{0.7,0}}" />
     103                        <Window Type="MenuWidgets/Checkbox" Name="orxonox/Display/More/VSync" >
     104                            <Property Name="Text" Value="VSync" />
     105                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     106                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.45,0}}" />
     107                            <Event Name="CheckStateChanged" Function="GraphicsMenu.callback_VSyncCheckbox_CheckStateChanged" />
     108                        </Window>
     109                        <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/More/FSAALabel" >
     110                            <Property Name="Text" Value="FSAA" />
     111                            <Property Name="FrameEnabled" Value="False" />
     112                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     113                            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.55,0},{0.3,0},{0.9,0}}" />
     114                            <Property Name="BackgroundEnabled" Value="False" />
     115                        </Window>
     116                        <Window Type="MenuWidgets/Combobox" Name="orxonox/Display/More/FSAA" >
     117                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     118                            <Property Name="ClippedByParent" Value="False" />
     119                            <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.55,0},{0.95,0},{2.1,0}}" />
     120                            <Property Name="MaxEditTextLength" Value="1073741823" />
     121                            <Event Name="ListSelectionAccepted" Function="GraphicsMenu.callback_FSAACombobox_ListSelectionAccepted" />
     122                        </Window>
     123                    </Window>
     124                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/Notice" >
     125                        <Property Name="Font" Value="BlueHighway-12" />
     126                        <Property Name="Text" >Changing the theme, FSAA,
     127or VSync requires a restart</Property>
     128                        <Property Name="HorzFormatting" Value="HorzCentred" />
     129                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     130                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.75,0},{0.975,0},{0.96,0}}" />
     131                    </Window>
     132                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/NoticeRed" >
     133                        <Property Name="Font" Value="BlueHighway-12" />
     134                        <Property Name="Text" >Changing the theme, FSAA,
     135or VSync requires a restart</Property>
     136                        <Property Name="TextColours" Value="tl:FFFF0000 tr:FFFF8888 bl:FFFF8888 br:FFFFFFFF" />
     137                        <Property Name="HorzFormatting" Value="HorzCentred" />
     138                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     139                        <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.75,0},{0.975,0},{0.96,0}}" />
     140                    </Window>
     141                </Window>
     142                <Window Type="DefaultWindow" Name="orxonox/Settings" >
     143                    <Property Name="Text" Value="Settings" />
     144                    <Property Name="Visible" Value="False" />
     145                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     146                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
     147                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings/FovLabel" >
     148                        <Property Name="Text" Value="Vertical field of view (FOV)" />
     149                        <Property Name="FrameEnabled" Value="False" />
     150                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     151                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.05,0},{0.5,0},{0.12,0}}" />
     152                        <Property Name="BackgroundEnabled" Value="False" />
     153                    </Window>
     154                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings/FpsLimitLabel" >
     155                        <Property Name="Text" Value="Maximal frame rate" />
     156                        <Property Name="FrameEnabled" Value="False" />
     157                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     158                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.18,0},{0.5,0},{0.25,0}}" />
     159                        <Property Name="BackgroundEnabled" Value="False" />
     160                    </Window>
     161                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Settings/ParticleLodLabel" >
     162                        <Property Name="Text" Value="Particle detail level" />
     163                        <Property Name="FrameEnabled" Value="False" />
     164                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     165                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.31,0},{0.5,0},{0.38,0}}" />
     166                        <Property Name="BackgroundEnabled" Value="False" />
     167                    </Window>
     168                    <Window Type="MenuWidgets/Editbox" Name="orxonox/Settings/Fov" >
     169                        <Property Name="MaxTextLength" Value="1073741823" />
     170                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     171                        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.03,0},{0.65,0},{0.14,0}}" />
     172                    </Window>
     173                    <Window Type="MenuWidgets/Editbox" Name="orxonox/Settings/FpsLimit" >
     174                        <Property Name="MaxTextLength" Value="1073741823" />
     175                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     176                        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.16,0},{0.65,0},{0.27,0}}" />
     177                    </Window>
     178                    <Window Type="MenuWidgets/Combobox" Name="orxonox/Settings/ParticleLodCombobox" >
     179                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     180                        <Property Name="ClippedByParent" Value="False" />
     181                        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.29,0},{0.7,0},{0.725,0}}" />
     182                        <Property Name="MaxEditTextLength" Value="1073741823" />
     183                    </Window>
     184                    <Window Type="MenuWidgets/Checkbox" Name="orxonox/Settings/ModelLodCheckbox" >
     185                        <Property Name="Text" Value="Enable model LOD" />
     186                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     187                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.44,0},{0.5,0},{0.51,0}}" />
     188                    </Window>
     189                    <Window Type="MenuWidgets/Checkbox" Name="orxonox/Settings/MotionBlurCheckbox" >
     190                        <Property Name="Text" Value="Enable motion blur" />
     191                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     192                        <Property Name="UnifiedAreaRect" Value="{{0.035,0},{0.57,0},{0.5,0},{0.64,0}}" />
     193                    </Window>
    29194                </Window>
    30195            </Window>
    31             <Window Type="MenuWidgets/StaticText" Name="orxonox/Themes" >
    32                 <Property Name="Text" Value="Themes" />
    33                 <Property Name="InheritsAlpha" Value="False" />
    34                 <Property Name="HorzFormatting" Value="HorzCentred" />
    35                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    36                 <Property Name="VertFormatting" Value="TopAligned" />
    37                 <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.10,0},{0.95,0},{0.35,0}}" />
    38                 <Window Type="MenuWidgets/Listbox" Name="orxonox/ThemeDropBox" >
    39                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    40                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.3,0},{0.95,0},{0.95,0}" />
    41                     <Event Name="ItemSelectionChanged" Function="GraphicsMenu.ThemeDropBox_changed"/>
    42                 </Window>
    43             </Window>
    44             <Window Type="MenuWidgets/StaticText" Name="orxonox/Brightness" >
    45                 <Property Name="Text" Value="Brightness" />
    46                 <Property Name="InheritsAlpha" Value="False" />
    47                 <Property Name="HorzFormatting" Value="HorzCentred" />
    48                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    49                 <Property Name="VertFormatting" Value="TopAligned" />
    50                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.70,0},{0.475,0},{0.85,0}}" />
    51                 <Window Type="MenuWidgets/HorizontalScrollbar" Name="orxonox/BrightnessScrollbar" >
    52                     <Property Name="Disabled" Value="true" />
    53                     <Property Name="PageSize" Value="0" />
    54                     <Property Name="StepSize" Value="0.1" />
    55                     <Property Name="OverlapSize" Value="0" />
    56                     <Property Name="DocumentSize" Value="1" />
    57                     <Property Name="ScrollPosition" Value="0" />
    58                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    59                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
    60                     <Event Name="ThumbTrackStarted" Function="GraphicsMenu.GraphicsBrightnessScrollbar_started" />
    61                     <Event Name="ThumbTrackEnded" Function="GraphicsMenu.GraphicsBrightnessScrollbar_ended" />
    62                     <Event Name="ScrollPosChanged" Function="GraphicsMenu.GraphicsBrightnessScrollbar_changed" />
    63                 </Window>
    64             </Window>
    65             <Window Type="MenuWidgets/Checkbox" Name="orxonox/FullscreenCheckbox" >
    66                 <Property Name="Text" Value="Fullscreen" />
    67                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    68                 <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.35,0},{0.85,0},{0.425,0}}" />
    69                 <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
    70             </Window>
    71             <Window Type="MenuWidgets/StaticText" Name="orxonox/GraphicsInfo" >
    72                 <Property Name="Text" >
    73 Changes in graphics
    74 settings require
    75 a game restart.</Property>
    76                 <Property Name="TextColours" Value="FFFFFFFF" />
    77                 <Property Name="InheritsAlpha" Value="False" />
    78                 <Property Name="HorzFormatting" Value="HorzCentred" />
    79                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    80                 <Property Name="VertFormatting" Value="TopAligned" />
    81                 <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.425,0},{0.95,0},{0.85,0}}" />
    82             </Window>
    83196        </Window>
    84         <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsBackButton" >
    85             <Property Name="Text" Value="Back" />
     197        <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsOkButton" >
     198            <Property Name="Text" Value="OK" />
    86199            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    87             <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
    88             <Event Name="Clicked" Function="GraphicsMenu.GraphicsBackButton_clicked"/>
     200            <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.6625,0},{0.4875,0},{0.7125,0}}" />
     201            <Event Name="Clicked" Function="GraphicsMenu.callback_Ok_Clicked" />
     202        </Window>
     203        <Window Type="MenuWidgets/Button" Name="orxonox/GraphicsCancelButton" >
     204            <Property Name="Text" Value="Cancel" />
     205            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     206            <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.6625,0},{0.7125,0},{0.7125,0}}" />
     207            <Event Name="Clicked" Function="GraphicsMenu.callback_Cancel_Clicked" />
    89208        </Window>
    90209    </Window>
  • code/branches/usability/data/gui/scripts/GUISheet.lua

    r7928 r8018  
    2626-- Override this function if you need to do work on quit
    2727function P:onQuit()
     28end
     29
     30-- Override this function if you want to react on keystrokes
     31function P:onKeyPressed()
     32end
     33
     34-- Override this function if you want to update the gui after the window was resized
     35function P:onWindowResized()
    2836end
    2937
     
    92100    end
    93101
    94     self.onKeyPressed()
    95 end
    96 
    97 -- Override this function if you want to ract on keystrokes
    98 function P:onKeyPressed()
     102    self:onKeyPressed()
     103end
     104
     105function P:windowResized()
     106    self:onWindowResized()
    99107end
    100108
  • code/branches/usability/data/gui/scripts/GraphicsMenu.lua

    r7928 r8018  
    33local P = createMenuSheet("GraphicsMenu")
    44
     5P.resolutionList = {"custom", "640 x 480", "720 x 480", "720 x 576", "800 x 600", "1024 x 600", "1024 x 768", "1152 x 864", "1280 x 720", "1280 x 800", "1280 x 960", "1280 x 1024", "1360 x 768", "1440 x 900", "1600 x 900", "1600 x 1200", "1680 x 1050"}
    56P.schemeList = {"TaharezGreen", "Orxonox"}
    6 
    7 function P.onLoad()
    8     block = true
    9     file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
    10     search_mode = 0
    11     f = io.open(file, "r")
    12     firstline = f:read("*line")
    13     rendersystem = string.sub(firstline, 15)
    14     for line in f:lines() do
    15         if search_mode == 0 then
    16             if string.find(line, rendersystem) ~= nil then
    17                 search_mode = 1
    18             end
     7P.fsaaList = {"0", "2", "4", "8", "8 [Quality]"}
     8P.particleLodList = {"None", "Low", "Normal", "High"}
     9
     10function P:onLoad()
     11    -------------------
     12    -- Button matrix --
     13    -------------------
     14
     15    P:setButton(1, 1, {
     16            ["button"] = winMgr:getWindow("orxonox/GraphicsOkButton"),
     17            ["callback"]  = P.callback_Ok_Clicked
     18    })
     19
     20    P:setButton(1, 2, {
     21            ["button"] = winMgr:getWindow("orxonox/GraphicsCancelButton"),
     22            ["callback"]  = P.callback_Cancel_Clicked
     23    })
     24
     25    -- place apply button at the bottom in the matrix, even though it's in fact at the top, to make the OK button highlighted by default
     26    P:setButton(2, 1, {
     27            ["button"] = winMgr:getWindow("orxonox/Display/Resolution/Apply"),
     28            ["callback"]  = P.callback_Apply_Clicked
     29    })
     30
     31    -----------------
     32    -- Combo boxes --
     33    -----------------
     34
     35    -- resolution combobox
     36    local resolutionCombobox = winMgr:getWindow("orxonox/Display/Resolution/Combobox")
     37    CEGUI.toCombobox(resolutionCombobox):setReadOnly(true)
     38
     39    for k,v in pairs(P.resolutionList) do
     40        local item = CEGUI.createListboxTextItem(v)
     41        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     42        resolutionCombobox:addItem(item)
     43    end
     44
     45    -- themes combobox
     46    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
     47    CEGUI.toCombobox(themeCombobox):setReadOnly(true)
     48
     49    for k,v in pairs(P.schemeList) do
     50        local item = CEGUI.createListboxTextItem(v)
     51        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     52        themeCombobox:addItem(item)
     53    end
     54
     55    -- fsaa combobox
     56    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
     57    CEGUI.toCombobox(fsaaCombobox):setReadOnly(true)
     58
     59    for k,v in pairs(P.fsaaList) do
     60        local item = CEGUI.createListboxTextItem(v)
     61        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     62        fsaaCombobox:addItem(item)
     63    end
     64
     65    -- particle lod combobox
     66    local particleLodCombobox = winMgr:getWindow("orxonox/Settings/ParticleLodCombobox")
     67    CEGUI.toCombobox(particleLodCombobox):setReadOnly(true)
     68
     69    for k,v in pairs(P.particleLodList) do
     70        local item = CEGUI.createListboxTextItem(v)
     71        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
     72        particleLodCombobox:addItem(item)
     73    end
     74end
     75
     76function P:onShow()
     77    -----------------
     78    -- Display tab --
     79    -----------------
     80
     81    -- fullscreen checkbox / resolution combobox / resolution editboxes
     82    self:onWindowResized()
     83
     84    -- apply button
     85    self.updateApplyButton()
     86
     87    -- aspect ratio editbox
     88    local aspectRatioEditbox = winMgr:getWindow("orxonox/Display/Resolution/AspectRatio")
     89    local currentAspectRatio = orxonox.CommandExecutor:query("getConfig Camera aspectRatio_")
     90    aspectRatioEditbox:setText(currentAspectRatio)
     91
     92    -- themes combobox
     93    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
     94    local currentScheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
     95
     96    for i = 0, themeCombobox:getDropList():getItemCount() - 1 do
     97        local item = themeCombobox:getListboxItemFromIndex(i)
     98        themeCombobox:setItemSelectState(item, (item:getText() == currentScheme))
     99    end
     100
     101    -- vsync checkbox
     102    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
     103    local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
     104    CEGUI.toCheckbox(vsyncCheckbox):setSelected(hasVSync)
     105
     106    -- fsaa combobox
     107    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
     108    local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
     109
     110    for i = 0, fsaaCombobox:getDropList():getItemCount() - 1 do
     111        local item = fsaaCombobox:getListboxItemFromIndex(i)
     112        fsaaCombobox:setItemSelectState(item, (item:getText() == currentFSAAMode))
     113    end
     114
     115    -- notice
     116    local notice = winMgr:getWindow("orxonox/Display/Notice")
     117    notice:setVisible(true)
     118    local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
     119    noticeRed:setVisible(false)
     120
     121    ------------------
     122    -- Settings tab --
     123    ------------------
     124
     125    -- fov editbox
     126    local fovEditbox = winMgr:getWindow("orxonox/Settings/Fov")
     127    local currentFov = orxonox.CommandExecutor:query("getConfig Camera fov_")
     128    fovEditbox:setText(currentFov)
     129
     130    -- fps limit editbox
     131    local fpsEditbox = winMgr:getWindow("orxonox/Settings/FpsLimit")
     132    local currentFpsLimit = orxonox.CommandExecutor:query("getConfig GraphicsSettings fpsLimit")
     133    fpsEditbox:setText(currentFpsLimit)
     134
     135    -- particle lod combobox
     136    local particleLodCombobox = winMgr:getWindow("orxonox/Settings/ParticleLodCombobox")
     137    local currentParticleLod = orxonox.CommandExecutor:query("getConfig GraphicsSettings particlesDetailLevel")
     138
     139    if currentParticleLod == "" then
     140        particleLodCombobox:disable()
     141    else
     142        particleLodCombobox:enable()
     143
     144        for i = 0, particleLodCombobox:getDropList():getItemCount() - 1 do
     145            local item = particleLodCombobox:getListboxItemFromIndex(i)
     146            particleLodCombobox:setItemSelectState(item, (tostring(i) == currentParticleLod))
    19147        end
    20         if search_mode == 1 then
    21             if string.sub(line, 1, 11) == "Full Screen" then
    22                 if string.sub(line, 13) == "Yes" then
    23                     fullscreen = true
    24                 else
    25                     fullscreen = false
    26                 end
    27             end
    28             if string.sub(line, 1, 10) == "Video Mode" then
    29                 if string.match(line, "@") == "@" then
    30                     resolution = string.sub(line, 12, string.find(line, "@")-2)
    31                 else
    32                     resolution = string.sub(line, 12)
    33                 end
    34                 break
    35             end
     148    end
     149
     150    -- model lod checkbox
     151    local modelLodCheckbox = winMgr:getWindow("orxonox/Settings/ModelLodCheckbox")
     152    local hasModelLod = orxonox.CommandExecutor:query("getConfig GraphicsSettings enableModelLoD")
     153    if hasModelLod == "true" then
     154        hasModelLod = true
     155    elseif hasModelLod == "false" then
     156        hasModelLod = false
     157    end
     158    CEGUI.toCheckbox(modelLodCheckbox):setSelected(hasModelLod)
     159
     160    -- motion blur checkbox
     161    local motionBlurCheckbox = winMgr:getWindow("orxonox/Settings/MotionBlurCheckbox")
     162    local hasMotionBlur = orxonox.CommandExecutor:query("getConfig GraphicsSettings enableMotionBlur")
     163    if hasMotionBlur == "true" then
     164        hasMotionBlur = true
     165    elseif hasMotionBlur == "false" then
     166        hasMotionBlur = false
     167    end
     168    CEGUI.toCheckbox(motionBlurCheckbox):setSelected(hasMotionBlur)
     169end
     170
     171function P:onWindowResized()
     172    -- fullscreen checkbox
     173    local fullscreenCheckbox = winMgr:getWindow("orxonox/Display/Resolution/Fullscreen")
     174    local isFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
     175    CEGUI.toCheckbox(fullscreenCheckbox):setSelected(isFullscreen)
     176
     177    -- resolution combobox
     178    local resolutionCombobox = winMgr:getWindow("orxonox/Display/Resolution/Combobox")
     179
     180    local currentWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
     181    local currentHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
     182    local currentResolution = currentWidth .. " x " .. currentHeight
     183
     184    for i = 0, resolutionCombobox:getDropList():getItemCount() - 1 do
     185        local item = resolutionCombobox:getListboxItemFromIndex(i)
     186        resolutionCombobox:setItemSelectState(item, item:getText() == currentResolution)
     187    end
     188
     189    -- resolution editboxes
     190    self.updateResolutionEditboxes()
     191end
     192
     193----------------------
     194-- Helper functions --
     195----------------------
     196
     197-- updates the text of the resolution checkboxes and checks if they should be enabled (only if the "custom" resolution was selected)
     198function P.updateResolutionEditboxes()
     199    -- resolution combobox
     200    local resolutionCombobox = winMgr:getWindow("orxonox/Display/Resolution/Combobox")
     201
     202    local currentWidth = orxonox.GraphicsManager:getInstance():getWindowWidth()
     203    local currentHeight = orxonox.GraphicsManager:getInstance():getWindowHeight()
     204
     205    -- resolution editboxes
     206    local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
     207    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
     208    widthEditbox:disable()
     209    heightEditbox:disable()
     210
     211    -- selected combobox item
     212    local item = resolutionCombobox:getSelectedItem()
     213    if item then
     214        local itemText = item:getText()
     215        if itemText ~= "custom" then
     216            currentWidth = string.sub(itemText, 1, string.find(itemText, "x") - 2)
     217            currentHeight = string.sub(itemText, string.find(itemText, "x") + 2)
     218        else
     219            widthEditbox:enable()
     220            heightEditbox:enable()
    36221        end
    37222    end
    38     f:close()
    39     local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox")
    40     fullscreenwindow:setSelected(fullscreen)
    41     listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox")
    42     local resolutionList = {}
    43     table.insert(resolutionList, "640 x 480")
    44     table.insert(resolutionList, "720 x 480")
    45     table.insert(resolutionList, "720 x 576")
    46     table.insert(resolutionList, "800 x 480")
    47     table.insert(resolutionList, "800 x 600")
    48     table.insert(resolutionList, "1024 x 480")
    49     table.insert(resolutionList, "1024 x 600")
    50     table.insert(resolutionList, "1024 x 768")
    51     table.insert(resolutionList, "1152 x 864")
    52     table.insert(resolutionList, "1280 x 720")
    53     table.insert(resolutionList, "1280 x 768")
    54     table.insert(resolutionList, "1440 x 900")
    55     for k,v in pairs(resolutionList) do
    56         item = CEGUI.createListboxTextItem(v)
    57         item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    58         CEGUI.toListbox(listboxwindow):addItem(item)
    59     end
    60     if resolution == "640 x 480" then
    61         listboxwindow:setItemSelectState(0,true)
    62     elseif resolution == "720 x 480" then
    63         listboxwindow:setItemSelectState(1,true)
    64     elseif resolution == "720 x 576" then
    65         listboxwindow:setItemSelectState(2,true)
    66     elseif resolution == "800 x 480" then
    67         listboxwindow:setItemSelectState(3,true)
    68     elseif resolution == "800 x 600" then
    69         listboxwindow:setItemSelectState(4,true)
    70     elseif resolution == "1024 x 480" then
    71         listboxwindow:setItemSelectState(5,true)
    72     elseif resolution == "1024 x 600" then
    73         listboxwindow:setItemSelectState(6,true)
    74     elseif resolution == "1024 x 768" then
    75         listboxwindow:setItemSelectState(7,true)
    76     elseif resolution == "1152 x 864" then
    77         listboxwindow:setItemSelectState(8,true)
    78     elseif resolution == "1280 x 720" then
    79         listboxwindow:setItemSelectState(9,true)
    80     elseif resolution == "1280 x 768" then
    81         listboxwindow:setItemSelectState(10,true)
    82     elseif resolution == "1440 x 900" then
    83         listboxwindow:setItemSelectState(11,true)
    84     end
    85     scrollbar_active = false
    86     block = false
    87 
    88     P:setButton(1, 1, {
    89             ["button"] = winMgr:getWindow("orxonox/GraphicsBackButton"),
    90             ["callback"]  = P.GraphicsBackButton_clicked
    91     })
    92 
    93     local dropbox = winMgr:getWindow("orxonox/ThemeDropBox")
    94     local scheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
    95     for k,v in pairs(P.schemeList) do
    96         local item = CEGUI.createListboxTextItem(P.schemeList[k])
    97         item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
    98         CEGUI.toListbox(dropbox):addItem(item)
    99         if v == scheme then
    100             dropbox:setItemSelectState(item, true)
    101         end
    102     end
    103 
    104 end
    105 
    106 function P.ThemeDropBox_changed(e)
    107     local dropbox = winMgr:getWindow("orxonox/ThemeDropBox")
    108     local listbox = CEGUI.toListbox(dropbox)
    109     local choice = listbox:getFirstSelectedItem()
    110     local index = 0
    111     if choice ~= nil then
    112         index = listbox:getItemIndex(choice)
    113     end
    114     orxonox.CommandExecutor:execute("config GUIManager guiScheme_ " .. P.schemeList[index+1])
    115 end
    116 
    117 function P.GraphicsResolutionListbox_changed(e)
    118     if listboxwindow:isItemSelected(0) then
    119         resolution = "640 x 480"
    120     elseif listboxwindow:isItemSelected(1) then
    121         resolution = "720 x 480"
    122     elseif listboxwindow:isItemSelected(2) then
    123         resolution = "720 x 576"
    124     elseif listboxwindow:isItemSelected(3) then
    125         resolution = "800 x 480"
    126     elseif listboxwindow:isItemSelected(4) then
    127         resolution = "800 x 600"
    128     elseif listboxwindow:isItemSelected(5) then
    129         resolution = "1024 x 480"
    130     elseif listboxwindow:isItemSelected(6) then
    131         resolution = "1024 x 600"
    132     elseif listboxwindow:isItemSelected(7) then
    133         resolution = "1024 x 768"
    134     elseif listboxwindow:isItemSelected(8) then
    135         resolution = "1152 x 864"
    136     elseif listboxwindow:isItemSelected(9) then
    137         resolution = "1280 x 720"
    138     elseif listboxwindow:isItemSelected(10) then
    139         resolution = "1280 x 768"
    140     elseif listboxwindow:isItemSelected(11) then
    141         resolution = "1440 x 900"
    142     end
    143     search_mode = 0
    144     f = io.open(file, "r")
    145     firstline = f:read("*line")
    146     text = firstline .. "\n"
    147     rendersystem = string.sub(firstline, 15)
    148     for line in f:lines() do
    149         if search_mode == 0 then
    150             if string.find(line, rendersystem) ~= nil then
    151                 search_mode = 1
    152             end
    153         end
    154         if search_mode == 1 then
    155             if string.sub(line, 1, 10) == "Video Mode" then
    156                 if string.match(line, "@") == "@" then
    157                     line = "Video Mode=" .. resolution .. string.sub(line, string.find(line, "@")-1)
    158                 else
    159                     line = "Video Mode=" .. resolution
    160                 end
    161                 search_mode = 2
    162             end
    163         end
    164         text = text .. line .. "\n"
    165     end
    166     f:close()
    167     f = io.open(file, "w")
    168     f:write(text)
    169     f:close()
    170 end
    171 
    172 function P.GraphicsBrightnessScrollbar_changed(e)
    173     if scrollbar_active == false then
    174         -- brightness
    175         logMessage(0, "event: brightness")
    176     end
    177 end
    178 
    179 function P.GraphicsBrightnessScrollbar_started(e)
    180     scrollbar_active = true
    181 end
    182 
    183 function P.GraphicsBrightnessScrollbar_ended(e)
    184     -- brightness
    185     logMessage(0, "event: brightness")
    186     scrollbar_active = false
    187 end
    188 
    189 function P.GraphicsFullscreenCheckbox_clicked(e)
    190     if block == false then
    191         search_mode = 0
    192         f = io.open(file, "r")
    193         firstline = f:read("*line")
    194         text = firstline .. "\n"
    195         rendersystem = string.sub(firstline, 15)
    196         for line in f:lines() do
    197             if search_mode == 0 then
    198                 if string.find(line, rendersystem) ~= nil then
    199                     search_mode = 1
    200                 end
    201             end
    202             if search_mode == 1 then
    203                 if string.sub(line, 1, 11) == "Full Screen" then
    204                     if fullscreen == true then
    205                         line = "Full Screen=No"
    206                         fullscreen = false
    207                     else
    208                         line = "Full Screen=Yes"
    209                         fullscreen = true
    210                     end
    211                     search_mode = 2
    212                 end
    213             end
    214             text = text .. line .. "\n"
    215         end
    216         f:close()
    217         f = io.open(file, "w")
    218         f:write(text)
    219         f:close()
    220     end
    221 end
    222 
    223 function P.GraphicsBackButton_clicked(e)
     223
     224    widthEditbox:setText(currentWidth)
     225    heightEditbox:setText(currentHeight)
     226end
     227
     228-- checks if the apply button should be enabled or disabled (only enabled if the current settings are different from the selected values)
     229function P.updateApplyButton()
     230    -- fullscreen checkbox
     231    local fullscreenCheckbox = winMgr:getWindow("orxonox/Display/Resolution/Fullscreen")
     232    local isFullscreen = orxonox.GraphicsManager:getInstance():isFullScreen()
     233    local fullscreenChanged = (isFullscreen ~= CEGUI.toCheckbox(fullscreenCheckbox):isSelected())
     234
     235    -- resolution editboxes
     236    local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
     237    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
     238    local currentWidth = tostring(orxonox.GraphicsManager:getInstance():getWindowWidth())
     239    local currentHeight = tostring(orxonox.GraphicsManager:getInstance():getWindowHeight())
     240    local widthChanged = (currentWidth ~= widthEditbox:getText())
     241    local heightChanged = (currentHeight ~= heightEditbox:getText())
     242    local resolutionEditboxesEnabled = not widthEditbox:isDisabled()
     243
     244    -- apply button
     245    local applyButton = winMgr:getWindow("orxonox/Display/Resolution/Apply")
     246
     247    if fullscreenChanged or widthChanged or heightChanged or resolutionEditboxesEnabled then
     248        applyButton:enable()
     249    else
     250        applyButton:disable()
     251    end
     252end
     253
     254function P.makeLabelRed()
     255    local notice = winMgr:getWindow("orxonox/Display/Notice")
     256    notice:setVisible(false)
     257    local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
     258    noticeRed:setVisible(true)
     259end
     260
     261---------------------
     262-- Event callbacks --
     263---------------------
     264
     265-- resolution
     266
     267function P.callback_FullscreenCheckbox_CheckStateChanged(e)
     268    P.updateApplyButton()
     269end
     270
     271function P.callback_ResolutionCombobox_ListSelectionAccepted(e)
     272    P.updateResolutionEditboxes()
     273end
     274
     275function P.callback_ResolutionEditboxWidth_TextChanged(e)
     276    P.updateApplyButton()
     277end
     278
     279function P.callback_ResolutionEditboxHeight_TextChanged(e)
     280    P.updateApplyButton()
     281end
     282
     283-- theme
     284
     285function P.callback_ThemeCombobox_ListSelectionAccepted(e)
     286    P.makeLabelRed()
     287end
     288
     289-- vsync
     290
     291function P.callback_VSyncCheckbox_CheckStateChanged(e)
     292    P.makeLabelRed()
     293end
     294
     295-- fsaa
     296
     297function P.callback_FSAACombobox_ListSelectionAccepted(e)
     298    P.makeLabelRed()
     299end
     300
     301-- buttons
     302
     303function P.callback_Apply_Clicked(e)
     304    -- resolution
     305    local fullscreenCheckbox = winMgr:getWindow("orxonox/Display/Resolution/Fullscreen")
     306    local checkedFullscreen = tostring(CEGUI.toCheckbox(fullscreenCheckbox):isSelected())
     307
     308    local widthEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxWidth")
     309    local heightEditbox = winMgr:getWindow("orxonox/Display/Resolution/EditboxHeight")
     310
     311    orxonox.CommandExecutor:execute("GraphicsManager setScreenResolution " .. widthEditbox:getText() .. " " .. heightEditbox:getText() .. " " .. checkedFullscreen)
     312
     313    P.updateApplyButton()
     314end
     315
     316function P.callback_Ok_Clicked(e)
     317    -- aspect ratio
     318    local aspectRatioEditbox = winMgr:getWindow("orxonox/Display/Resolution/AspectRatio")
     319    orxonox.CommandExecutor:execute("config Camera aspectRatio_ " .. aspectRatioEditbox:getText())
     320
     321    -- theme
     322    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
     323    orxonox.CommandExecutor:execute("config GUIManager guiScheme_ " .. themeCombobox:getText())
     324
     325    -- vsync
     326    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
     327    orxonox.CommandExecutor:execute("GraphicsManager setVSync " .. tostring(CEGUI.toCheckbox(vsyncCheckbox):isSelected()))
     328
     329    -- fsaa
     330    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
     331    orxonox.CommandExecutor:execute("GraphicsManager setFSAA {" .. fsaaCombobox:getText() .. "}") -- enclose argument in { ... } because it can contain [brackets] (conflicts with tcl)
     332
     333    -- fov
     334    local fovEditbox = winMgr:getWindow("orxonox/Settings/Fov")
     335    orxonox.CommandExecutor:execute("config Camera fov_ " .. fovEditbox:getText())
     336
     337    -- fps limit
     338    local fpsEditbox = winMgr:getWindow("orxonox/Settings/FpsLimit")
     339    orxonox.CommandExecutor:execute("config GraphicsSettings fpsLimit " .. fpsEditbox:getText())
     340
     341    -- particle lod
     342    local particleLodCombobox = winMgr:getWindow("orxonox/Settings/ParticleLodCombobox")
     343    local item = particleLodCombobox:getSelectedItem()
     344    if item then
     345        orxonox.CommandExecutor:execute("config GraphicsSettings particlesDetailLevel " .. particleLodCombobox:getItemIndex(item))
     346    end
     347
     348    -- model lod
     349    local modelLodCheckbox = winMgr:getWindow("orxonox/Settings/ModelLodCheckbox")
     350    orxonox.CommandExecutor:execute("config GraphicsSettings enableModelLoD " .. tostring(CEGUI.toCheckbox(modelLodCheckbox):isSelected()))
     351
     352    -- motion blur
     353    local motionBlurCheckbox = winMgr:getWindow("orxonox/Settings/MotionBlurCheckbox")
     354    orxonox.CommandExecutor:execute("config GraphicsSettings enableMotionBlur " .. tostring(CEGUI.toCheckbox(motionBlurCheckbox):isSelected()))
     355
    224356    hideMenuSheet(P.name)
    225357end
    226358
     359function P.callback_Cancel_Clicked(e)
     360    hideMenuSheet(P.name)
     361end
     362
    227363return P
    228364
  • code/branches/usability/data/gui/scripts/SheetManager.lua

    r8013 r8018  
    88local mainMenuLoaded = false
    99orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
     10orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized")
    1011
    1112-----------------------
     
    255256end
    256257
     258function windowResized(e)
     259    local sheet = activeMenuSheets[activeMenuSheets.size]
     260    if sheet then
     261        sheet.sheet:windowResized()
     262    end
     263end
     264
    257265function setBackgroundImage(imageSet, imageName)
    258266    guiMgr:setBackgroundImage(imageSet, imageName)
  • code/branches/usability/data/overlays/debug.oxo

    r7935 r8018  
    6868    <PauseNotice
    6969     name     = "pausenotice"
    70      position = "0.5, 0.3"
     70     position = "0.5, 0.1"
    7171     font     = "VeraMono"
    7272     textsize = 0.03
Note: See TracChangeset for help on using the changeset viewer.