Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 6, 2009, 10:48:39 PM (15 years ago)
Author:
cmueri
Message:

Fullscreen and resolution changes are now available in the menu.

Location:
code/branches/presentation2/data/gui
Files:
2 edited

Legend:

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

    r6238 r6262  
    1515            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1616            <Property Name="VertFormatting" Value="TopAligned" />
    17             <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.325,0},{0.75,0},{0.6,0}}" />
     17            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.25,0},{0.75,0},{0.6,0}}" />
    1818            <Window Type="TaharezLook/StaticText" Name="orxonox/Resolution" >
    1919                <Property Name="Text" Value="Resolution" />
     
    2222                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    2323                <Property Name="VertFormatting" Value="TopAligned" />
    24                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.2,0},{0.475,0},{0.9,0}}" />
    25                 <Window Type="TaharezLook/Combobox" Name="orxonox/ResolutionCombobox" >
    26                     <Property Name="ReadOnly" Value="True" />
    27                     <Property Name="AlwaysOnTop" Value="True" />
     24                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.475,0},{0.92,0}}" />
     25                <Window Type="TaharezLook/Listbox" Name="orxonox/ResolutionListbox" >
    2826                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    29                     <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.21,0},{0.95,0},{0.9,0}}" />
    30                     <Property Name="MaxEditTextLength" Value="1073741823" />
    31                     <Event Name="ListSelectionAccepted" Function="GraphicsMenu.GraphicsResolutionCombobox_changed"/>
    32                 </Window>
    33                 <Window Type="TaharezLook/Checkbox" Name="orxonox/FullscreenCheckbox" >
    34                     <Property Name="Text" Value="Fullscreen" />
    35                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    36                     <Property Name="UnifiedAreaRect" Value="{{0.275,0},{0.725,0},{0.725,0},{0.85,0}}" />
    37                     <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
     27                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
     28                    <Event Name="ItemSelectionChanged" Function="GraphicsMenu.GraphicsResolutionListbox_changed"/>
    3829                </Window>
    3930            </Window>
     
    4435                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    4536                <Property Name="VertFormatting" Value="TopAligned" />
    46                 <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.2,0},{0.95,0},{0.45,0}}" />
     37                <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.15,0},{0.95,0},{0.35,0}}" />
    4738                <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/BrightnessScrollbar" >
     39                    <Property Name="Disabled" Value="true" />
    4840                    <Property Name="PageSize" Value="0" />
    4941                    <Property Name="StepSize" Value="0.1" />
     
    5850                </Window>
    5951            </Window>
     52            <Window Type="TaharezLook/Checkbox" Name="orxonox/FullscreenCheckbox" >
     53                <Property Name="Text" Value="Fullscreen" />
     54                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     55                <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.4,0},{0.95,0},{0.475,0}}" />
     56                <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
     57            </Window>
    6058            <Window Type="TaharezLook/StaticText" Name="orxonox/GraphicsInfo" >
    61                 <Property Name="Text" >Changes in graphics
     59                <Property Name="Text" >
     60Changes in graphics
    6261settings require
    6362a game restart.</Property>
     
    6766                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    6867                <Property Name="VertFormatting" Value="TopAligned" />
    69                 <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.55,0},{0.95,0},{0.9,0}}" />
     68                <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.525,0},{0.95,0},{0.92,0}}" />
    7069            </Window>
    7170        </Window>
     
    7776        </Window>
    7877        <Window Type="TaharezLook/StaticText" Name="orxonox/GraphicsAvailable" >
    79             <Property Name="Text" Value="All the graphics functions are not yet available." />
     78            <Property Name="Text" Value="The brightness scrollbar is not yet available." />
    8079            <Property Name="TextColours" Value="FFFF0000" />
    8180            <Property Name="InheritsAlpha" Value="False" />
  • code/branches/presentation2/data/gui/scripts/GraphicsMenu.lua

    r6259 r6262  
    1313
    1414function P:init()
     15    block = true
    1516    file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
    16     --file = "C:\\Games\\Orxonox\\menu\\build\\config\\Debug\\" .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
    1717    search_mode = 0
    1818    f = io.open(file, "r")
     
    3232                    fullscreen = false
    3333                end
     34            end
     35            if string.sub(line, 1, 10) == "Video Mode" then
     36                if string.match(line, "@") == "@" then
     37                    resolution = string.sub(line, 12, string.find(line, "@")-2)
     38                else
     39                    resolution = string.sub(line, 12)
     40                end
    3441                break
    3542            end
     
    3946    local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox")
    4047    fullscreenwindow:setSelected(fullscreen)
    41     dropdown = winMgr:getWindow("orxonox/ResolutionCombobox")
     48    listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox")
    4249    local resolutionList = {}
    43     table.insert(resolutionList, "800 x 600  (4:3)")
    44     table.insert(resolutionList, "1024 x 640  (16:10)")
    45     table.insert(resolutionList, "1024 x 768  (4:3)")
    46     table.insert(resolutionList, "1280 x 800  (16:10)")
    47     table.insert(resolutionList, "1280 x 960  (4:3)")
    48     table.insert(resolutionList, "1440 x 900  (16:10)")
    49     table.insert(resolutionList, "1600 x 1200  (4:3)")
    50     table.insert(resolutionList, "1680 x 1050  (16:10)")
     50    table.insert(resolutionList, "640 x 480")
     51    table.insert(resolutionList, "720 x 480")
     52    table.insert(resolutionList, "720 x 576")
     53    table.insert(resolutionList, "800 x 480")
     54    table.insert(resolutionList, "800 x 600")
     55    table.insert(resolutionList, "1024 x 480")
     56    table.insert(resolutionList, "1024 x 600")
     57    table.insert(resolutionList, "1024 x 768")
     58    table.insert(resolutionList, "1152 x 864")
     59    table.insert(resolutionList, "1280 x 720")
     60    table.insert(resolutionList, "1280 x 768")
     61    table.insert(resolutionList, "1440 x 900")
    5162    for k,v in pairs(resolutionList) do
    5263        item = CEGUI.createListboxTextItem(v)       
    5364        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
    54         CEGUI.toCombobox(dropdown):addItem(item)
    55     end
    56     local scrollbar_active = false
    57 end
    58 
    59 function P.GraphicsResolutionCombobox_changed(e)
    60     -- resolution
    61     debug("event: resolution")
    62 end
    63 
    64 function P.GraphicsBrightnessScrollbar_changed(e)
    65     if scrollbar_active == false then
    66         -- brightness
    67         debug("event: brightness")
    68     end
    69 end
    70 
    71 function P.GraphicsBrightnessScrollbar_started(e)
    72     scrollbar_active = true
    73 end
    74 
    75 function P.GraphicsBrightnessScrollbar_ended(e)
    76     -- brightness
    77     debug("event: brightness")
     65        CEGUI.toListbox(listboxwindow):addItem(item)
     66    end
     67    if resolution == "640 x 480" then
     68        listboxwindow:setItemSelectState(0,true)
     69    elseif resolution == "720 x 480" then
     70        listboxwindow:setItemSelectState(1,true)
     71    elseif resolution == "720 x 576" then
     72        listboxwindow:setItemSelectState(2,true)
     73    elseif resolution == "800 x 480" then
     74        listboxwindow:setItemSelectState(3,true)
     75    elseif resolution == "800 x 600" then
     76        listboxwindow:setItemSelectState(4,true)
     77    elseif resolution == "1024 x 480" then
     78        listboxwindow:setItemSelectState(5,true)
     79    elseif resolution == "1024 x 600" then
     80        listboxwindow:setItemSelectState(6,true)
     81    elseif resolution == "1024 x 768" then
     82        listboxwindow:setItemSelectState(7,true)
     83    elseif resolution == "1152 x 864" then
     84        listboxwindow:setItemSelectState(8,true)
     85    elseif resolution == "1280 x 720" then
     86        listboxwindow:setItemSelectState(9,true)
     87    elseif resolution == "1280 x 768" then
     88        listboxwindow:setItemSelectState(10,true)
     89    elseif resolution == "1440 x 900" then
     90        listboxwindow:setItemSelectState(11,true)
     91    end
    7892    scrollbar_active = false
    79 end
    80 
    81 function P.GraphicsFullscreenCheckbox_clicked(e)
     93    block = false
     94end
     95
     96function P.GraphicsResolutionListbox_changed(e)
     97    if listboxwindow:isItemSelected(0) then
     98        resolution = "640 x 480"
     99    elseif listboxwindow:isItemSelected(1) then
     100        resolution = "720 x 480"
     101    elseif listboxwindow:isItemSelected(2) then
     102        resolution = "720 x 576"
     103    elseif listboxwindow:isItemSelected(3) then
     104        resolution = "800 x 480"
     105    elseif listboxwindow:isItemSelected(4) then
     106        resolution = "800 x 600"
     107    elseif listboxwindow:isItemSelected(5) then
     108        resolution = "1024 x 480"
     109    elseif listboxwindow:isItemSelected(6) then
     110        resolution = "1024 x 600"
     111    elseif listboxwindow:isItemSelected(7) then
     112        resolution = "1024 x 768"
     113    elseif listboxwindow:isItemSelected(8) then
     114        resolution = "1152 x 864"
     115    elseif listboxwindow:isItemSelected(9) then
     116        resolution = "1280 x 720"
     117    elseif listboxwindow:isItemSelected(10) then
     118        resolution = "1280 x 768"
     119    elseif listboxwindow:isItemSelected(11) then
     120        resolution = "1440 x 900"
     121    end
    82122    search_mode = 0
    83123    f = io.open(file, "r")
     
    92132        end
    93133        if search_mode == 1 then
    94             if string.sub(line, 1, 11) == "Full Screen" then
    95                 if fullscreen == true then
    96                     line = "Full Screen=No"
    97                     fullscreen = false
     134            if string.sub(line, 1, 10) == "Video Mode" then
     135                if string.match(line, "@") == "@" then
     136                    line = "Video Mode=" .. resolution .. string.sub(line, string.find(line, "@")-1)
    98137                else
    99                     line = "Full Screen=Yes"
    100                     fullscreen = true
    101                 end
    102                 debug(line)
     138                    line = "Video Mode=" .. resolution
     139                end
    103140                search_mode = 2
    104141            end
     
    112149end
    113150
     151function P.GraphicsBrightnessScrollbar_changed(e)
     152    if scrollbar_active == false then
     153        -- brightness
     154        debug("event: brightness")
     155    end
     156end
     157
     158function P.GraphicsBrightnessScrollbar_started(e)
     159    scrollbar_active = true
     160end
     161
     162function P.GraphicsBrightnessScrollbar_ended(e)
     163    -- brightness
     164    debug("event: brightness")
     165    scrollbar_active = false
     166end
     167
     168function P.GraphicsFullscreenCheckbox_clicked(e)
     169    if block == false then
     170        search_mode = 0
     171        f = io.open(file, "r")
     172        firstline = f:read("*line")
     173        text = firstline .. "\n"
     174        rendersystem = string.sub(firstline, 15)
     175        for line in f:lines() do
     176            if search_mode == 0 then
     177                if string.find(line, rendersystem) ~= nil then
     178                    search_mode = 1
     179                end
     180            end
     181            if search_mode == 1 then
     182                if string.sub(line, 1, 11) == "Full Screen" then
     183                    if fullscreen == true then
     184                        line = "Full Screen=No"
     185                        fullscreen = false
     186                    else
     187                        line = "Full Screen=Yes"
     188                        fullscreen = true
     189                    end
     190                    search_mode = 2
     191                end
     192            end
     193            text = text .. line .. "\n"
     194        end
     195        f:close()
     196        f = io.open(file, "w")
     197        f:write(text)
     198        f:close()
     199    end
     200end
     201
    114202function P.GraphicsBackButton_clicked(e)
    115203    hideGUI(P.filename)
Note: See TracChangeset for help on using the changeset viewer.