mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
Use *ARB versions for VBOs in SpriteBatch. Throw error if SpriteBatch not
supported. Prettier overloading of SpriteBatch:add[q]().
This commit is contained in:
@@ -1306,14 +1306,22 @@ AAIAAAxQCuxfDzz1AB8IAAAAAAC6ufC4AAAAALrCZ5H+if4dCkwHbQAAAAgAAQAAAAAAAA==
|
||||
return lgprint(text, x,y, unpack_transform(...))
|
||||
end
|
||||
|
||||
local temp_img = love.graphics.newImage(love.image.newImageData(0,0))
|
||||
local temp_spritebatch = love.graphics.newSpriteBatch(temp_img, 0)
|
||||
local sb_meta = getmetatable(temp_spritebatch)
|
||||
local add, addq = sb_meta.add, sb_meta.addq
|
||||
function sb_meta:add(x,y, ...)
|
||||
return add(self, x,y, unpack_transform(...))
|
||||
end
|
||||
function sb_meta:addq(quad, x,y, ...)
|
||||
return addq(self, quad, x,y, unpack_transform(...))
|
||||
local newSpritebatch = love.graphics.newSpriteBatch
|
||||
function love.graphics.newSpriteBatch(image, size)
|
||||
local sb = newSpritebatch(image, size)
|
||||
local meta = getmetatable(sb)
|
||||
|
||||
local add = meta.add
|
||||
function meta:add(x,y, ...)
|
||||
return add(self, x,y, unpack_transform(...))
|
||||
end
|
||||
|
||||
local addq = meta.addq
|
||||
function meta:addq(quad, x,y, ...)
|
||||
return addq(self, quad, x,y, unpack_transform(...))
|
||||
end
|
||||
|
||||
love.graphics.newSpriteBatch = newSpritebatch
|
||||
return sb
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user