Compare commits
3 Commits
208321b864
...
8262b62e4c
Author | SHA1 | Date |
---|---|---|
Jill | 8262b62e4c | |
Jill | fc97481a02 | |
Jill | d874c39388 |
33
main.xml
33
main.xml
|
@ -175,6 +175,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
local actorsInitialized = false -- if true, no new actors can be created
|
local actorsInitialized = false -- if true, no new actors can be created
|
||||||
|
local actorsInitializing = false -- the above but a bit more explicit
|
||||||
|
|
||||||
local luaobj
|
local luaobj
|
||||||
|
|
||||||
|
@ -205,6 +206,7 @@
|
||||||
|
|
||||||
local function onCommand(self)
|
local function onCommand(self)
|
||||||
actorsInitialized = true
|
actorsInitialized = true
|
||||||
|
actorsInitializing = false
|
||||||
uranium:call('init')
|
uranium:call('init')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -233,6 +235,11 @@
|
||||||
'Overlay', 'Underlay',
|
'Overlay', 'Underlay',
|
||||||
'ScoreP1', 'ScoreP2',
|
'ScoreP1', 'ScoreP2',
|
||||||
'LifeP1', 'LifeP2',
|
'LifeP1', 'LifeP2',
|
||||||
|
'PlayerOptionsP1', 'PlayerOptionsP2', 'SongOptions',
|
||||||
|
'LifeFrame', 'ScoreFrame',
|
||||||
|
'DifficultyP1', 'DifficultyP2',
|
||||||
|
'BPMDisplay',
|
||||||
|
'MemoryCardDisplayP1', 'MemoryCardDisplayP2'
|
||||||
} do
|
} do
|
||||||
local child = SCREENMAN(element)
|
local child = SCREENMAN(element)
|
||||||
if child then child:hidden(1) end
|
if child then child:hidden(1) end
|
||||||
|
@ -244,6 +251,9 @@
|
||||||
local specialActorFrames = {} -- ones defined specifically; here for drawfunction jank
|
local specialActorFrames = {} -- ones defined specifically; here for drawfunction jank
|
||||||
|
|
||||||
function setDrawFunction(frame, func)
|
function setDrawFunction(frame, func)
|
||||||
|
if not frame.__raw then error('uranium: cannot set actorframe drawfunction during module loadtime! put this in uranium.init or actor:addcommand(\'Init\', ...)', 2) end
|
||||||
|
if not frame.SetDrawFunction then error('uranium: expected an actorframe but got something that doesn\'t even bother to implement SetDrawFunction', 2) end
|
||||||
|
if type(func) ~= 'function' then error('uranium: tried to set a drawfunction to a.. ' .. type(func) .. '?? the hell', 2) end
|
||||||
frame:SetDrawFunction(function()
|
frame:SetDrawFunction(function()
|
||||||
for i = 1, frame:GetNumChildren() do
|
for i = 1, frame:GetNumChildren() do
|
||||||
local a = frame:GetChildAt(i - 1)
|
local a = frame:GetChildAt(i - 1)
|
||||||
|
@ -257,6 +267,7 @@
|
||||||
|
|
||||||
function setShader(actor, shader)
|
function setShader(actor, shader)
|
||||||
if not shader.__raw then error('uranium: cannot set shader during module loadtime! put this in uranium.init or actor:addcommand(\'Init\', ...)', 2) end
|
if not shader.__raw then error('uranium: cannot set shader during module loadtime! put this in uranium.init or actor:addcommand(\'Init\', ...)', 2) end
|
||||||
|
if not actor.__raw then error('uranium: cannot set shader while the actor hasn\'t been loaded!', 2) end
|
||||||
actor:SetShader(shader.__raw)
|
actor:SetShader(shader.__raw)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -483,6 +494,7 @@
|
||||||
|
|
||||||
local function createGenericFunc(type)
|
local function createGenericFunc(type)
|
||||||
return function()
|
return function()
|
||||||
|
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 actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
|
||||||
local actor = createProxyActor(type)
|
local actor = createProxyActor(type)
|
||||||
table.insert(actorQueue, {
|
table.insert(actorQueue, {
|
||||||
|
@ -502,6 +514,7 @@
|
||||||
ActorFrameTexture = createGenericFunc('ActorFrameTexture')
|
ActorFrameTexture = createGenericFunc('ActorFrameTexture')
|
||||||
|
|
||||||
function Sprite(file)
|
function Sprite(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 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 actor = createProxyActor('Sprite')
|
||||||
|
@ -519,6 +532,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function ActorFrame()
|
function ActorFrame()
|
||||||
|
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 actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
|
||||||
local actor = createProxyActor('ActorFrame')
|
local actor = createProxyActor('ActorFrame')
|
||||||
table.insert(actorQueue, {
|
table.insert(actorQueue, {
|
||||||
|
@ -536,6 +550,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function Shader(frag, vert)
|
function Shader(frag, vert)
|
||||||
|
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 actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
|
||||||
local actor = createProxyActor('RageShaderProgram')
|
local actor = createProxyActor('RageShaderProgram')
|
||||||
|
|
||||||
|
@ -571,6 +586,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function Model(file)
|
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
|
if actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
|
||||||
if not file then error('uranium: cannot create a Model without a file', 2) end
|
if not file then error('uranium: cannot create a Model without a file', 2) end
|
||||||
local actor = createProxyActor('Model')
|
local actor = createProxyActor('Model')
|
||||||
|
@ -586,6 +602,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function BitmapText(font, text)
|
function BitmapText(font, text)
|
||||||
|
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 actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
|
||||||
local actor = createProxyActor('BitmapText')
|
local actor = createProxyActor('BitmapText')
|
||||||
table.insert(actorQueue, {
|
table.insert(actorQueue, {
|
||||||
|
@ -601,6 +618,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function ActorSound(file)
|
function ActorSound(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 actorsInitialized then error('uranium: cannot create an actor during runtime!!', 2) end
|
||||||
if not file then error('uranium: cannot create an ActorSound without a file', 2) end
|
if not file then error('uranium: cannot create an ActorSound without a file', 2) end
|
||||||
local actor = createProxyActor('ActorSound')
|
local actor = createProxyActor('ActorSound')
|
||||||
|
@ -616,6 +634,18 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function addChild(frame, actor)
|
function addChild(frame, actor)
|
||||||
|
if actorsInitializing then
|
||||||
|
error('uranium: cannot create frame-child associations during actor initialization', 2)
|
||||||
|
end
|
||||||
|
if actorsInitialized then
|
||||||
|
error('uranium: cannot create frame-child associations after actors have been initialized', 2)
|
||||||
|
end
|
||||||
|
if not frame.__lock then
|
||||||
|
error('uranium: ActorFrame passed into addChild must be one instantiated with ActorFrame()!', 2)
|
||||||
|
end
|
||||||
|
if not actor.__lock then
|
||||||
|
error('uranium: trying to add a child to an ActorFrame that isn\'t an actor; please read the first half of \'ActorFrame\'', 2)
|
||||||
|
end
|
||||||
actorAssociationQueue[actor.__queue] = frame.__queue
|
actorAssociationQueue[actor.__queue] = frame.__queue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -625,7 +655,7 @@
|
||||||
local iter = 0
|
local iter = 0
|
||||||
while #actorQueue > 0 do
|
while #actorQueue > 0 do
|
||||||
iter = iter + 1
|
iter = iter + 1
|
||||||
if iter > 999999 then
|
if iter > 99999 then
|
||||||
error('uranium: failed to transform queue to tree: reached maximum iteration limit! is there an actor with an invalid actorframe?')
|
error('uranium: failed to transform queue to tree: reached maximum iteration limit! is there an actor with an invalid actorframe?')
|
||||||
end
|
end
|
||||||
for i = #actorQueue, 1, -1 do
|
for i = #actorQueue, 1, -1 do
|
||||||
|
@ -729,6 +759,7 @@
|
||||||
|
|
||||||
print('---')
|
print('---')
|
||||||
|
|
||||||
|
actorsInitializing = true
|
||||||
transformQueueToTree()
|
transformQueueToTree()
|
||||||
--Trace(fullDump(actorTree))
|
--Trace(fullDump(actorTree))
|
||||||
currentPath = actorTree
|
currentPath = actorTree
|
||||||
|
|
Loading…
Reference in New Issue