Skip to content
Snippets Groups Projects
Commit 72f960c4 authored by dg's avatar dg
Browse files

Resizing the game window is now persistent

Confusion got a fullscreen graphical effect


git-svn-id: http://svn.net-core.org/repos/t-engine4@1308 51575b47-30f0-44d4-a5cc-537603b46e54
parent fd489915
No related branches found
No related tags found
No related merge requests found
......@@ -230,11 +230,18 @@ available_resolutions =
["1600x1200 Fullscreen"] = {1600, 1200, true},
}
--- Change screen resolution
function _M:setResolution(res)
if not available_resolutions[res] then return false, "unknown resolution" end
function _M:setResolution(res, force)
local r = available_resolutions[res]
if force and not r then
local _, _, w, h = res:find("([0-9][0-9][0-9]+)x([0-9][0-9][0-9]+)")
w = tonumber(w)
h = tonumber(h)
if w and h then r = {w, h, false} end
end
if not r then return false, "unknown resolution" end
local old_w, old_h = self.w, self.h
core.display.setWindowSize(available_resolutions[res][1], available_resolutions[res][2], available_resolutions[res][3])
core.display.setWindowSize(r[1], r[2], r[3])
self.w, self.h = core.display.size()
if self.w ~= old_w or self.h ~= old_h then
......@@ -247,6 +254,7 @@ end
--- Called when screen resolution changes
function _M:onResolutionChange()
self.w, self.h = core.display.size()
self:saveSettings("resolution", ("window.size = %dx%d\n"):format(self.w, self.h))
end
--- Requests the game to save
......
......@@ -203,6 +203,11 @@ function _M:updateMainShader()
else game.fbo_shader:setUniform("colorize", {0,0,0}) -- Disable
end
-- Blur shader
if self:attr("confused") then game.fbo_shader:setUniform("blur", 2)
else game.fbo_shader:setUniform("blur", 0) -- Disable
end
-- Moving Blur shader
if self:attr("invisible") then game.fbo_shader:setUniform("motionblur", 3)
else game.fbo_shader:setUniform("motionblur", 0) -- Disable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment