add texture func

This commit is contained in:
Jill 2022-10-29 15:02:27 +03:00
parent 44bf4528df
commit f4e8c1df7c
2 changed files with 22 additions and 0 deletions

View File

@ -607,6 +607,24 @@
return actor
end
function Texture(file)
if actorsInitializing then error('uranium: cannot create an actor during actor initialization!!', 2) end
if actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
if not file then error('uranium: cannot create a texture without a file', 2) end
local actor = createProxyActor('RageTexture')
table.insert(actorQueue, {
type = 'Sprite',
file = file and oat.dir .. file,
init = function(a)
a:hidden(1)
actor.__lock(a:GetTexture())
end
})
actor.__queueRepresentation(actorQueue[#actorQueue])
return actor
end
function Model(file)
if actorsInitializing then error('uranium: cannot create an actor during actor initialization!!', 2) end
if actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end

View File

@ -30,6 +30,10 @@ function Polygon() end
--- Defines a Sprite actor.
function Sprite(file) end
---@param file string
---@return RageTexture
--- Defines a texture.
function Texture(file) end
---@param file string
---@return Model
--- Defines a Model actor.
function Model(file) end