aft support

This commit is contained in:
Jill 2022-09-19 21:33:55 +03:00
parent d5e2b0c252
commit 34fac4aa99
4 changed files with 35 additions and 8 deletions

View File

@ -437,14 +437,17 @@
Quad = createGenericFunc('Quad')
ActorProxy = createGenericFunc('ActorProxy')
Polygon = createGenericFunc('Polygon')
ActorFrameTexture = createGenericFunc('ActorFrameTexture')
function Sprite(file)
if actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
if not file then error('uranium: cannot create a Sprite without a file', 2) end
--if not file then error('uranium: cannot create a Sprite without a file', 2) end
local actor = createProxyActor('Sprite')
local type = nil
if not file then type = 'Sprite' end
table.insert(actorQueue, {
type = nil,
file = '../src/' .. oat._requirePath .. file,
type = type,
file = file and '../src/' .. oat._requirePath .. file,
init = function(a)
actor.__lock(a)
end

16
stdlib/aft.lua Normal file
View File

@ -0,0 +1,16 @@
function sprite(self)
self:basezoomx(sw / dw)
self:basezoomy(-sh / dh)
self:x(scx)
self:y(scy)
end
function aft(self)
self:SetWidth(dw)
self:SetHeight(dh)
self:EnableDepthBuffer(false)
self:EnableAlphaBuffer(false)
self:EnableFloat(false)
self:EnablePreserveTexture(true)
self:Create()
end

View File

@ -2,9 +2,9 @@ require('input')
bitop = require('bitop') -- TODO: tons of this is commented out because of '...'. FIX. IT.
require('rng')
require('easable')
require('easable2')
require('color')
require('vector2D')
require('ease')
uwuify = require('uwuify')
require('util')
require('util')
require('aft')

View File

@ -15,7 +15,7 @@ function ActorProxy() end
---@return Polygon
--- Defines a Polygon actor.
function Polygon() end
---@param file string
---@param file string | nil
---@return Sprite
--- Defines a Sprite actor.
function Sprite(file) end
@ -32,6 +32,9 @@ function BitmapText(font, text) end
---@return ActorSound
--- Defines an ActorSound actor.
function ActorSound(file) end
---@return ActorFrameTexture
--- Defines an ActorFrameTexture actor.
function ActorFrameTexture() end
---@param actor Actor
--- Resets an actor to its initial state
@ -65,6 +68,12 @@ sw = 0
---@type number
--- The screen height. Equal to `SCREEN_HEIGHT`.
sh = 0
---@type number
--- The display width.
dw = 0
---@type number
--- The display height.
dh = 0
--- The Uranium Template table! Mostly callback-related stuff goes here.
uranium = {}
@ -81,5 +90,4 @@ uranium.update = function() end
function uranium:call(event, ...) end
--- Equivalent to a modfile-sandboxed `_G`, similar to Mirin's `xero`. You shouldn't need this; and if you do, *what are you doing?*
---@type table<any, any>
oat = {}
oat = _G