I've created a small main.lua which demonstrates a couple of ways that the behaviour of this library deviates from the expected result in Love 0.10.2.
-- main.lua
local origLoveGraphics = love.graphics
require 'autobatch'
local catImage = love.graphics.newImage('demo/cats/cat.png')
function _helpDraw(label, lg, x)
local startingDrawCalls = lg.getStats().drawcalls
lg.print(label, x, 30)
-- Demonstrate BUG 1: love.graphics.push('all') .pop()
lg.setColor(255, 128, 128)
lg.push('all')
lg.setColor(128, 255, 128)
lg.push('all')
lg.setColor(128, 128, 255)
lg.draw(catImage, x, 115) -- Should be BLUE
lg.pop()
lg.draw(catImage, x, 170) -- Should be GREEN
lg.pop()
lg.draw(catImage, x, 225) -- Should be RED
-- Demonstrate BUG 2: love.graphics.setColor() values over 255
local val = 255 * 1.5
lg.setColor(val, val, val)
lg.draw(catImage, x, 330) -- Should be BRIGHT
val = 255 * 2
lg.setColor(val, val, val)
lg.draw(catImage, x, 385) -- Should be RIGHTER
val = 255 * 2.5
lg.setColor(val, val, val)
lg.draw(catImage, x, 440) -- Should be BRIGHTEST
-- Print all text.
-- Note that we do this at the end so that drawcalls aren't affected by lg.print()
lg.setColor(0, 0, 0)
local drawCalls = lg.getStats().drawcalls - startingDrawCalls
lg.print("drawcalls: " .. drawCalls, x, 50)
lg.print("BUG 1: .push('all') and .pop()", x, 100)
lg.print("BUG 2: .setColor() w/ val over 255", x, 315)
end
function love.draw()
love.graphics.clear(200, 200, 200)
_helpDraw('Untouched Love2d', origLoveGraphics, 30)
_helpDraw('autobatch.lua', love.graphics, 330)
end
Here's the output.