aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxgoff <antipotroast@gmail.com>2012-08-02 07:29:00 -0500
committerxgoff <antipotroast@gmail.com>2012-08-02 07:29:00 -0500
commit2b020850280e1d92cda7ae8a8d5abe39ddaed53f (patch)
treec3339245f74bb3b3bcda9fd648f741af872525e8
parent5307c4052398ef4dfe85c446a2c70533eb7700f6 (diff)
downloadlove2d-fakecanvas-2b020850280e1d92cda7ae8a8d5abe39ddaed53f.tar.gz
love2d-fakecanvas-2b020850280e1d92cda7ae8a8d5abe39ddaed53f.tar.bz2
love2d-fakecanvas-2b020850280e1d92cda7ae8a8d5abe39ddaed53f.tar.xz
love2d-fakecanvas-2b020850280e1d92cda7ae8a8d5abe39ddaed53f.zip
queried pixeleffect support and never actually used the result... oops
-rw-r--r--fakecanvas.lua19
1 files changed, 13 insertions, 6 deletions
diff --git a/fakecanvas.lua b/fakecanvas.lua
index 1647c3c..626e456 100644
--- a/fakecanvas.lua
+++ b/fakecanvas.lua
@@ -190,7 +190,9 @@ end
local registry = debug.getregistry() -- naughty!
-- throwaway, forces LOVE to load the :send() method
-love.graphics.newPixelEffect [[vec4 effect( vec4 x, Image y, vec2 z, vec2 w) { return vec4(0, 0, 0, 0); }]]
+if pixeleffect_supported then
+ love.graphics.newPixelEffect [[vec4 effect( vec4 x, Image y, vec2 z, vec2 w) { return vec4(0, 0, 0, 0); }]]
+end
local _love_funcs = {
getCanvas = love.graphics.getCanvas,
@@ -200,7 +202,7 @@ local _love_funcs = {
draw = love.graphics.draw,
drawq = love.graphics.drawq,
- pe_send = registry.PixelEffect.send,
+ pe_send = pixeleffect_supported and registry.PixelEffect.send,
--technically sendCanvas should also be wrapped but that's not officially exposed
}
local _wrap_funcs = {
@@ -244,7 +246,9 @@ function M.enable (state)
love.graphics.draw = _wrap_funcs.draw
love.graphics.drawq = _wrap_funcs.drawq
- registry.PixelEffect.send = _wrap_funcs.pe_send
+ if pixeleffect_supported then
+ registry.PixelEffect.send = _wrap_funcs.pe_send
+ end
elseif state == false then
love.graphics.getCanvas = function () return nil end
love.graphics.setCanvas = function () end
@@ -252,15 +256,18 @@ function M.enable (state)
love.graphics.draw = _love_funcs.draw
love.graphics.drawq = _love_funcs.drawq
- registry.PixelEffect.send = _love_funcs.pe_send
+ if pixeleffect_supported then
+ registry.PixelEffect.send = _love_funcs.pe_send
+ end
elseif state == nil and canvas_supported then
love.graphics.getCanvas = _love_funcs.getCanvas
love.graphics.setCanvas = _love_funcs.setCanvas
love.graphics.newCanvas = _love_funcs.newCanvas
love.graphics.draw = _love_funcs.draw
love.graphics.drawq = _love_funcs.drawq
-
- registry.PixelEffect.send = _love_funcs.pe_send
+ if pixeleffect_supported then
+ registry.PixelEffect.send = _love_funcs.pe_send
+ end
end
return M
end