Closed praisethemoon closed 1 year ago
Thanks for the issue, looks like setCanvas
was missing a variant which I've added in v11.4.1
. This object is a bit deceptive as it should be indexed with canvases and can be given properties like a standard object
Here's some ways to represent this in TypeScript:
const allowStencil: CanvasSetup = { stencil: true };
allowStencil[1] = this.canvas;
love.graphics.setCanvas(allowStencil);
This approach might help when initially trying to use setCanvas
if the type-errors are not easily understood
If happy with the results, you could shift to what is effectively the same expression in TypeScript
love.graphics.setCanvas({ [1]: this.canvas, stencil: true });
NOTE: These are all indexed at 1 as they aren't considered "arrays" by TypeScript
This pattern also shows up deeper within CanvasSetup
. I've put comments on the types for how to construct these objects and updated the CHANGELOG with some more info
Hello,
According this thread: https://love2d.org/forums/viewtopic.php?p=219664#p219664
It should be possible to call
Maybe I am doing somethign wrong, but if I
// @ts-ignore
it works.Cheers