Changeset 6262 for code/branches/presentation2/data/gui/scripts
- Timestamp:
- Dec 6, 2009, 10:48:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/scripts/GraphicsMenu.lua
r6259 r6262 13 13 14 14 function P:init() 15 block = true 15 16 file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_") 16 --file = "C:\\Games\\Orxonox\\menu\\build\\config\\Debug\\" .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_")17 17 search_mode = 0 18 18 f = io.open(file, "r") … … 32 32 fullscreen = false 33 33 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 34 41 break 35 42 end … … 39 46 local fullscreenwindow = tolua.cast(winMgr:getWindow("orxonox/FullscreenCheckbox"),"CEGUI::Checkbox") 40 47 fullscreenwindow:setSelected(fullscreen) 41 dropdown = winMgr:getWindow("orxonox/ResolutionCombobox")48 listboxwindow = winMgr:getWindow("orxonox/ResolutionListbox") 42 49 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") 51 62 for k,v in pairs(resolutionList) do 52 63 item = CEGUI.createListboxTextItem(v) 53 64 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 78 92 scrollbar_active = false 79 end 80 81 function P.GraphicsFullscreenCheckbox_clicked(e) 93 block = false 94 end 95 96 function 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 82 122 search_mode = 0 83 123 f = io.open(file, "r") … … 92 132 end 93 133 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) 98 137 else 99 line = "Full Screen=Yes" 100 fullscreen = true 101 end 102 debug(line) 138 line = "Video Mode=" .. resolution 139 end 103 140 search_mode = 2 104 141 end … … 112 149 end 113 150 151 function P.GraphicsBrightnessScrollbar_changed(e) 152 if scrollbar_active == false then 153 -- brightness 154 debug("event: brightness") 155 end 156 end 157 158 function P.GraphicsBrightnessScrollbar_started(e) 159 scrollbar_active = true 160 end 161 162 function P.GraphicsBrightnessScrollbar_ended(e) 163 -- brightness 164 debug("event: brightness") 165 scrollbar_active = false 166 end 167 168 function 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 200 end 201 114 202 function P.GraphicsBackButton_clicked(e) 115 203 hideGUI(P.filename)
Note: See TracChangeset
for help on using the changeset viewer.