Mercurial > love-experiments
diff src/scripts/graphics.lua @ 1211:9e6915ef96c8
Re-added "pixeleffect" graphics isSupported string for compatibility
| author | Alexander Szpakowski <amaranth72@gmail.com> |
|---|---|
| date | Mon, 31 Dec 2012 06:18:43 -0400 |
| parents | 7fcc650e8a59 |
| children | 8b07ec694e9a |
line wrap: on
line diff
--- a/src/scripts/graphics.lua Fri Dec 28 21:32:13 2012 -0400 +++ b/src/scripts/graphics.lua Mon Dec 31 06:18:43 2012 -0400 @@ -1323,20 +1323,20 @@ if vertcode then local s = vertcode:gsub("\r\n\t", " ") s = s:gsub("%w+(%s+)%(", "") - if s:match("vec4 effect%(") then + if s:match("vec4%s*effect%(") then fragcode = vertcode -- first argument contains frag shader code end - if not s:match("vec4 transform%(") then + if not s:match("vec4%s*transform%(") then vertcode = nil -- first argument doesn't contain vert shader code end end if fragcode then local s = fragcode:gsub("\r\n\t", " ") s = s:gsub("%w+(%s+)%(", "") - if s:match("vec4 transform%(") then + if s:match("vec4%s*transform%(") then vertcode = fragcode -- second argument contains vert shader code end - if not s:match("vec4 effect%(") then + if not s:match("vec4%s*effect%(") then fragcode = nil -- second argument doesn't contain frag shader code end end @@ -1382,6 +1382,8 @@ -- {a, b, c, d, e, f, ...} local function flattenMatrices(mat, ...) if not mat then return end + + local tonumber = tonumber local ret,l = {}, 1 ret.dimension = #mat @@ -1438,6 +1440,9 @@ return effect end + + -- compatibility functions + function love.graphics.newPixelEffect(fragcode) return love.graphics.newShaderEffect(nil, fragcode) end
