mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
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:
@@ -153,36 +153,43 @@ function lib.scaleform:setRenderTarget(name, model)
|
||||
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()
|
||||
if self.private.isDrawing then
|
||||
return
|
||||
end
|
||||
|
||||
self.private.isDrawing = true
|
||||
|
||||
CreateThread(function()
|
||||
while self.private.isDrawing do
|
||||
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
|
||||
|
||||
while self:isDrawing() do
|
||||
self:draw()
|
||||
Wait(0)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user