games50 / zelda

Lecture examples for Lecture 5: Legend of Zelda
35 stars 42 forks source link

Error in love.graphics.stencil(function() #1

Open alli1999 opened 4 years ago

alli1999 commented 4 years ago

Hey I was currently going through the zelda code and when I run it without making any changes I got this stencil error Error

src/world/Room.lua:214: Drawing to the stencil buffer with a Canvas active requires either stencil=true or a custom stencil-type Canvas to be used, in setCanvas.

Traceback

[C]: in function 'stencil' src/world/Room.lua:214: in function 'render' src/world/Dungeon.lua:152: in function 'render' src/states/game/PlayState.lua:51: in function 'render' src/StateMachine.lua:27: in function 'render' main.lua:58: in function 'draw' [C]: in function 'xpcall'

HOuebt commented 4 years ago

It is an issue since LÖVE Version 11.0: https://love2d.org/wiki/love.graphics.stencil. The solution is in the new push lib. You need the new push lib from: https://github.com/Ulydev/push. Now you set in love.load:

push:setupCanvas({
    { name = 'stencil_canvas', stencil = true}
})    

and in Room.lua above love.graphics.stencil(function() ... ):

push:setCanvas('stencil_canvas')

That should fix the problem.