examples/options: export widgets canvas as a real texture

It'll avoid screen change clearing the texture content
This commit is contained in:
Kazhnuz 2019-04-13 10:39:01 +02:00
parent defe5fea9a
commit ae5a001e00
1 changed files with 6 additions and 2 deletions

View File

@ -53,13 +53,17 @@ end
function BaseWidget:redrawCanvas()
self.width, self.height = self.menu:getWidgetSize(self.id)
self.canvas.texture = love.graphics.newCanvas(self.width, self.height)
love.graphics.setCanvas( self.canvas.texture )
local canvas = love.graphics.newCanvas(self.width, self.height)
love.graphics.setCanvas( canvas )
self:drawCanvas()
self.canvas.needRedraw = false
love.graphics.setCanvas( )
local imageData = canvas:newImageData( )
self.canvas.texture = love.graphics.newImage( imageData )
canvas:release( )
imageData:release( )
end
function BaseWidget:drawCanvas()