From 72f960c42bf41a9f05bf021b1efaad8946aea1bf Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Fri, 24 Sep 2010 12:32:46 +0000
Subject: [PATCH] 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
---
 game/engines/default/engine/Game.lua | 14 +++++++++++---
 game/modules/tome/class/Player.lua   |  5 +++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/game/engines/default/engine/Game.lua b/game/engines/default/engine/Game.lua
index b2f40c7da6..d49aa0493f 100644
--- a/game/engines/default/engine/Game.lua
+++ b/game/engines/default/engine/Game.lua
@@ -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
diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua
index 04cf784562..9fc27a6eb7 100644
--- a/game/modules/tome/class/Player.lua
+++ b/game/modules/tome/class/Player.lua
@@ -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
-- 
GitLab