aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--fakecanvas.lua2
2 files changed, 2 insertions, 1 deletions
diff --git a/README.md b/README.md
index 8aeea02..1344511 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,6 @@ love.graphics.setCanvas(canvas3)
```
the background gets saved when `setCanvas()` is called with an argument, but it doesn't get restored until it's called without an argument. currently only one state is saved so it's possible the above code would trash the background. this isn't a problem if you only ever use `renderTo()` because that automatically handles the `setCanvas()` calls
* `love.graphics.translate()`, `love.graphics.rotate()`, `love.graphics.scale()`, and `love.graphics.shear()` are not handled
-* stencils are not handled
* will changing modes during canvas drawing destroy the contents?
beware: i have done only minimal testing of this library so it's possible there are cases where it doesn't work correctly or at all, or that the entire idea is ultimately unworkable!
diff --git a/fakecanvas.lua b/fakecanvas.lua
index c881693..172d17b 100644
--- a/fakecanvas.lua
+++ b/fakecanvas.lua
@@ -147,6 +147,8 @@ savefbstate()
local function setCanvas (...)
assert(select("#", ...) == 0 or (select("#", ...) == 1 and type(...) == "userdata"), "Incorrect parameter type: expected userdata")
+ love.graphics.setStencil() -- fortunately LOVE does this as well which makes things much easier
+
local to = ...
if to then
current_canvas = canvases[to]