We accidentally enabled nested tables previously, and now it errors properly when the tables contain cycles. Before you'd get (or at least I got) a nice lua stack overflow error.
--HG--
branch : minor
Now love.event.poll just returns love.event.poll_i, instead of returning a new
c function every call. This means love no longer creates garbage each frame
(with an empty project).
See pull request #81 for details, and an alternative fix. Thanks @bjornbytes
for the pull request, and for finding this issue.
Note: in the pull request I also mentioned love.filesystem.lines/File:lines. I
haven't "fixed" those since they use actual closures.
--HG--
branch : minor
- Removed love.graphics.set/getCanvas, Canvas:renderTo, Canvas:newImageData, love.graphics.clear, love.graphics.discard, and love.graphics.newScreenshot.
- Added love.graphics.beginPass and love.graphics.endPass. All rendering must happen within a pass. love.draw is now called while a render pass to the main screen is active.
- Added love.graphics.renderPass, which is a wrapper for begin/endPass which calls the supplied function argument in between a begin/end. This is similar to the old Canvas:renderTo.
- Added love.graphics.isPassActive, getPassCanvases, getPassWidth, getPassHeight, and getPassDimensions.
- Added love.graphics.captureScreenshot.
- Added a new love.run callback love.drawpasses, which is called after love.update and before love.draw. It is the place to render to Canvases using beginPass or renderPass, since love.draw now always draws to the main screen.
- Renamed the ‘canvasswitches’ field in the table returned by love.graphics.getStats to ‘renderpasses’.
love.graphics.beginPass has the following variants (and renderPass mirrors them with an additional function argument at the end):
- love.graphics.beginPass(), begins rendering to the main screen without clearing it.
- love.graphics.beginPass(r, g, b [, a]), begins rendering to the main screen and clears the screen to the specified color.
- love.graphics.beginPass(canvas [, willstencil]), begins rendering to the specified Canvas without clearing it. love.graphics.stencil can only be used within the Canvas if ‘willstencil’ is true.
- love.graphics.beginPass(canvas, r, g, b [, a] [, willstencil]), beings rendering to the specified Canvas and clears it to the specified color. love.graphics.stencil can only be used within the Canvas if ‘willstencil’ is true.
- love.graphics.beginPass(info), where ‘info’ is a table in the following form:
{
{canvas [, r, g, b, a]}, — A canvas and an optional color to clear the Canvas to when the pass begins.
{canvas2, [r, g, b, a]}, — Additional Canvases and optional clear colors for multi-canvas rendering.
…,
stencil = false, — Optional boolean field to specify whether love.graphics.stencil is allowed within this pass. False by default.
}
The pass info table can be created once up-front and used for multiple beginPass/renderPass calls.
love.graphics.endPass can take an optional callback function argument, which causes endPass to capture the contents of the Canvas drawn to in the render pass to a new ImageData and passes it to the supplied function (this replaces Canvas:newImageData). This does not work on the main screen.
love.graphics.captureScreenshot replaces love.graphics.newScreenshot. It takes a callback function argument which causes love.graphics.present to capture the contents of the screen to a new ImageData and passes it to the supplied function. captureScreenshot can only be called before drawing to the main screen begins in the current frame (e.g. in love.keypressed, love.update, etc.)
--HG--
branch : minor
addListener takes a function, and names of events that will trigger the function when they're processed inside love.event.poll or love.event.wait. When the given listener function is called, the name of the event as well as all of the event's arguments are passed to the function.
If addListener is called multiple times with the same function and events, it will not add the function more than once.
removeListener takes a function and removes it from all events it was previously added to.
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.
- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.
Also removed most of the header declarations for wrapper functions.