From f4e8c1df7ca44eff65662d636fcb1ddb74254121 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Sat, 29 Oct 2022 15:02:27 +0300 Subject: [PATCH] add texture func --- main.xml | 18 ++++++++++++++++++ typings.lua | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/main.xml b/main.xml index c572a0c..47ea01d 100644 --- a/main.xml +++ b/main.xml @@ -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 diff --git a/typings.lua b/typings.lua index 6ce6bc4..f40664b 100644 --- a/typings.lua +++ b/typings.lua @@ -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