fix(scaleform): invalid private property access

Adds an isDrawing and draw method to scaleforms.
So technically a feature I guess.
This commit is contained in:
Linden
2025-02-08 13:14:51 +11:00
parent b726faea2d
commit aa2f761a34

View File

@@ -153,36 +153,43 @@ function lib.scaleform:setRenderTarget(name, model)
end end
end end
---@return nil function lib.scaleform:isDrawing()
return self.private.isDrawing
end
function lib.scaleform:draw()
if self.target then
SetTextRenderId(self.target)
SetScriptGfxDrawOrder(4)
SetScriptGfxDrawBehindPausemenu(true)
SetScaleformFitRendertarget(self.sfHandle, true)
end
if self.fullScreen then
DrawScaleformMovieFullscreen(self.sfHandle, 255, 255, 255, 255, 0)
else
if not self.x or not self.y or not self.width or not self.height then
error('attempted to draw scaleform without setting properties')
else
DrawScaleformMovie(self.sfHandle, self.x, self.y, self.width, self.height, 255, 255, 255, 255, 0)
end
end
if self.target then
SetTextRenderId(1)
end
end
function lib.scaleform:startDrawing() function lib.scaleform:startDrawing()
if self.private.isDrawing then if self.private.isDrawing then
return return
end end
self.private.isDrawing = true self.private.isDrawing = true
CreateThread(function() CreateThread(function()
while self.private.isDrawing do while self:isDrawing() do
if self.target then self:draw()
SetTextRenderId(self.target)
SetScriptGfxDrawOrder(4)
SetScriptGfxDrawBehindPausemenu(true)
SetScaleformFitRendertarget(self.sfHandle, true)
end
if self.fullScreen then
DrawScaleformMovieFullscreen(self.sfHandle, 255, 255, 255, 255, 0)
else
if not self.x or not self.y or not self.width or not self.height then
error('attempted to draw scaleform without setting properties')
else
DrawScaleformMovie(self.sfHandle, self.x, self.y, self.width, self.height, 255, 255, 255, 255, 0)
end
end
if self.target then
SetTextRenderId(1)
end
Wait(0) Wait(0)
end end
end) end)