[Orxonox-commit 1544] r6262 - in code/branches/presentation2/data/gui: layouts scripts
cmueri at orxonox.net
cmueri at orxonox.net
Sun Dec 6 22:48:39 CET 2009
Author: cmueri
Date: 2009-12-06 22:48:39 +0100 (Sun, 06 Dec 2009)
New Revision: 6262
Modified:
code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout
code/branches/presentation2/data/gui/scripts/GraphicsMenu.lua
Log:
Fullscreen and resolution changes are now available in the menu.
Modified: code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout
===================================================================
--- code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout 2009-12-06 20:47:42 UTC (rev 6261)
+++ code/branches/presentation2/data/gui/layouts/GraphicsMenu.layout 2009-12-06 21:48:39 UTC (rev 6262)
@@ -14,28 +14,19 @@
<Property Name="HorzFormatting" Value="HorzCentred" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="VertFormatting" Value="TopAligned" />
- <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.325,0},{0.75,0},{0.6,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.25,0},{0.75,0},{0.6,0}}" />
<Window Type="TaharezLook/StaticText" Name="orxonox/Resolution" >
<Property Name="Text" Value="Resolution" />
<Property Name="InheritsAlpha" Value="False" />
<Property Name="HorzFormatting" Value="HorzCentred" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="VertFormatting" Value="TopAligned" />
- <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.2,0},{0.475,0},{0.9,0}}" />
- <Window Type="TaharezLook/Combobox" Name="orxonox/ResolutionCombobox" >
- <Property Name="ReadOnly" Value="True" />
- <Property Name="AlwaysOnTop" Value="True" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.475,0},{0.92,0}}" />
+ <Window Type="TaharezLook/Listbox" Name="orxonox/ResolutionListbox" >
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.21,0},{0.95,0},{0.9,0}}" />
- <Property Name="MaxEditTextLength" Value="1073741823" />
- <Event Name="ListSelectionAccepted" Function="GraphicsMenu.GraphicsResolutionCombobox_changed"/>
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
+ <Event Name="ItemSelectionChanged" Function="GraphicsMenu.GraphicsResolutionListbox_changed"/>
</Window>
- <Window Type="TaharezLook/Checkbox" Name="orxonox/FullscreenCheckbox" >
- <Property Name="Text" Value="Fullscreen" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.275,0},{0.725,0},{0.725,0},{0.85,0}}" />
- <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
- </Window>
</Window>
<Window Type="TaharezLook/StaticText" Name="orxonox/Brightness" >
<Property Name="Text" Value="Brightness" />
@@ -43,8 +34,9 @@
<Property Name="HorzFormatting" Value="HorzCentred" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="VertFormatting" Value="TopAligned" />
- <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.2,0},{0.95,0},{0.45,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.15,0},{0.95,0},{0.35,0}}" />
<Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/BrightnessScrollbar" >
+ <Property Name="Disabled" Value="true" />
<Property Name="PageSize" Value="0" />
<Property Name="StepSize" Value="0.1" />
<Property Name="OverlapSize" Value="0" />
@@ -57,8 +49,15 @@
<Event Name="ScrollPosChanged" Function="GraphicsMenu.GraphicsBrightnessScrollbar_changed" />
</Window>
</Window>
+ <Window Type="TaharezLook/Checkbox" Name="orxonox/FullscreenCheckbox" >
+ <Property Name="Text" Value="Fullscreen" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.4,0},{0.95,0},{0.475,0}}" />
+ <Event Name="CheckStateChanged" Function="GraphicsMenu.GraphicsFullscreenCheckbox_clicked"/>
+ </Window>
<Window Type="TaharezLook/StaticText" Name="orxonox/GraphicsInfo" >
- <Property Name="Text" >Changes in graphics
+ <Property Name="Text" >
+Changes in graphics
settings require
a game restart.</Property>
<Property Name="TextColours" Value="FF4444FF" />
@@ -66,7 +65,7 @@
<Property Name="HorzFormatting" Value="HorzCentred" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="VertFormatting" Value="TopAligned" />
- <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.55,0},{0.95,0},{0.9,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.525,0},{0.525,0},{0.95,0},{0.92,0}}" />
</Window>
</Window>
<Window Type="TaharezLook/Button" Name="orxonox/GraphicsBackButton" >
@@ -76,7 +75,7 @@
<Event Name="Clicked" Function="GraphicsMenu.GraphicsBackButton_clicked"/>
</Window>
<Window Type="TaharezLook/StaticText" Name="orxonox/GraphicsAvailable" >
- <Property Name="Text" Value="All the graphics functions are not yet available." />
+ <Property Name="Text" Value="The brightness scrollbar is not yet available." />
<Property Name="TextColours" Value="FFFF0000" />
<Property Name="InheritsAlpha" Value="False" />
<Property Name="HorzFormatting" Value="HorzCentred" />
Modified: code/branches/presentation2/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/GraphicsMenu.lua 2009-12-06 20:47:42 UTC (rev 6261)
+++ code/branches/presentation2/data/gui/scripts/GraphicsMenu.lua 2009-12-06 21:48:39 UTC (rev 6262)
@@ -12,8 +12,8 @@
P.layoutString = "GraphicsMenu.layout"
function P:init()
+ block = true
file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
- --file = "C:\\Games\\Orxonox\\menu\\build\\config\\Debug\\" .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")
search_mode = 0
f = io.open(file, "r")
firstline = f:read("*line")
@@ -31,6 +31,13 @@
else
fullscreen = false
end
+ end
+ if string.sub(line, 1, 10) == "Video Mode" then
+ if string.match(line, "@") == "@" then
+ resolution = string.sub(line, 12, string.find(line, "@")-2)
+ else
+ resolution = string.sub(line, 12)
+ end
break
end
end
@@ -38,47 +45,80 @@
f:close()
local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox")
fullscreenwindow:setSelected(fullscreen)
- dropdown = winMgr:getWindow("orxonox/ResolutionCombobox")
+ listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox")
local resolutionList = {}
- table.insert(resolutionList, "800 x 600 (4:3)")
- table.insert(resolutionList, "1024 x 640 (16:10)")
- table.insert(resolutionList, "1024 x 768 (4:3)")
- table.insert(resolutionList, "1280 x 800 (16:10)")
- table.insert(resolutionList, "1280 x 960 (4:3)")
- table.insert(resolutionList, "1440 x 900 (16:10)")
- table.insert(resolutionList, "1600 x 1200 (4:3)")
- table.insert(resolutionList, "1680 x 1050 (16:10)")
+ table.insert(resolutionList, "640 x 480")
+ table.insert(resolutionList, "720 x 480")
+ table.insert(resolutionList, "720 x 576")
+ table.insert(resolutionList, "800 x 480")
+ table.insert(resolutionList, "800 x 600")
+ table.insert(resolutionList, "1024 x 480")
+ table.insert(resolutionList, "1024 x 600")
+ table.insert(resolutionList, "1024 x 768")
+ table.insert(resolutionList, "1152 x 864")
+ table.insert(resolutionList, "1280 x 720")
+ table.insert(resolutionList, "1280 x 768")
+ table.insert(resolutionList, "1440 x 900")
for k,v in pairs(resolutionList) do
item = CEGUI.createListboxTextItem(v)
item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
- CEGUI.toCombobox(dropdown):addItem(item)
+ CEGUI.toListbox(listboxwindow):addItem(item)
end
- local scrollbar_active = false
-end
-
-function P.GraphicsResolutionCombobox_changed(e)
- -- resolution
- debug("event: resolution")
-end
-
-function P.GraphicsBrightnessScrollbar_changed(e)
- if scrollbar_active == false then
- -- brightness
- debug("event: brightness")
+ if resolution == "640 x 480" then
+ listboxwindow:setItemSelectState(0,true)
+ elseif resolution == "720 x 480" then
+ listboxwindow:setItemSelectState(1,true)
+ elseif resolution == "720 x 576" then
+ listboxwindow:setItemSelectState(2,true)
+ elseif resolution == "800 x 480" then
+ listboxwindow:setItemSelectState(3,true)
+ elseif resolution == "800 x 600" then
+ listboxwindow:setItemSelectState(4,true)
+ elseif resolution == "1024 x 480" then
+ listboxwindow:setItemSelectState(5,true)
+ elseif resolution == "1024 x 600" then
+ listboxwindow:setItemSelectState(6,true)
+ elseif resolution == "1024 x 768" then
+ listboxwindow:setItemSelectState(7,true)
+ elseif resolution == "1152 x 864" then
+ listboxwindow:setItemSelectState(8,true)
+ elseif resolution == "1280 x 720" then
+ listboxwindow:setItemSelectState(9,true)
+ elseif resolution == "1280 x 768" then
+ listboxwindow:setItemSelectState(10,true)
+ elseif resolution == "1440 x 900" then
+ listboxwindow:setItemSelectState(11,true)
end
-end
-
-function P.GraphicsBrightnessScrollbar_started(e)
- scrollbar_active = true
-end
-
-function P.GraphicsBrightnessScrollbar_ended(e)
- -- brightness
- debug("event: brightness")
scrollbar_active = false
+ block = false
end
-function P.GraphicsFullscreenCheckbox_clicked(e)
+function P.GraphicsResolutionListbox_changed(e)
+ if listboxwindow:isItemSelected(0) then
+ resolution = "640 x 480"
+ elseif listboxwindow:isItemSelected(1) then
+ resolution = "720 x 480"
+ elseif listboxwindow:isItemSelected(2) then
+ resolution = "720 x 576"
+ elseif listboxwindow:isItemSelected(3) then
+ resolution = "800 x 480"
+ elseif listboxwindow:isItemSelected(4) then
+ resolution = "800 x 600"
+ elseif listboxwindow:isItemSelected(5) then
+ resolution = "1024 x 480"
+ elseif listboxwindow:isItemSelected(6) then
+ resolution = "1024 x 600"
+ elseif listboxwindow:isItemSelected(7) then
+ resolution = "1024 x 768"
+ elseif listboxwindow:isItemSelected(8) then
+ resolution = "1152 x 864"
+ elseif listboxwindow:isItemSelected(9) then
+ resolution = "1280 x 720"
+ elseif listboxwindow:isItemSelected(10) then
+ resolution = "1280 x 768"
+ elseif listboxwindow:isItemSelected(11) then
+ resolution = "1440 x 900"
+ end
search_mode = 0
f = io.open(file, "r")
firstline = f:read("*line")
@@ -91,15 +131,12 @@
end
end
if search_mode == 1 then
- if string.sub(line, 1, 11) == "Full Screen" then
- if fullscreen == true then
- line = "Full Screen=No"
- fullscreen = false
+ if string.sub(line, 1, 10) == "Video Mode" then
+ if string.match(line, "@") == "@" then
+ line = "Video Mode=" .. resolution .. string.sub(line, string.find(line, "@")-1)
else
- line = "Full Screen=Yes"
- fullscreen = true
+ line = "Video Mode=" .. resolution
end
- debug(line)
search_mode = 2
end
end
@@ -111,6 +148,57 @@
f:close()
end
+function P.GraphicsBrightnessScrollbar_changed(e)
+ if scrollbar_active == false then
+ -- brightness
+ debug("event: brightness")
+ end
+end
+
+function P.GraphicsBrightnessScrollbar_started(e)
+ scrollbar_active = true
+end
+
+function P.GraphicsBrightnessScrollbar_ended(e)
+ -- brightness
+ debug("event: brightness")
+ scrollbar_active = false
+end
+
+function P.GraphicsFullscreenCheckbox_clicked(e)
+ if block == false then
+ search_mode = 0
+ f = io.open(file, "r")
+ firstline = f:read("*line")
+ text = firstline .. "\n"
+ rendersystem = string.sub(firstline, 15)
+ for line in f:lines() do
+ if search_mode == 0 then
+ if string.find(line, rendersystem) ~= nil then
+ search_mode = 1
+ end
+ end
+ if search_mode == 1 then
+ if string.sub(line, 1, 11) == "Full Screen" then
+ if fullscreen == true then
+ line = "Full Screen=No"
+ fullscreen = false
+ else
+ line = "Full Screen=Yes"
+ fullscreen = true
+ end
+ search_mode = 2
+ end
+ end
+ text = text .. line .. "\n"
+ end
+ f:close()
+ f = io.open(file, "w")
+ f:write(text)
+ f:close()
+ end
+end
+
function P.GraphicsBackButton_clicked(e)
hideGUI(P.filename)
end
More information about the Orxonox-commit
mailing list