34 lines
816 B
Plaintext
34 lines
816 B
Plaintext
import standard;
|
|
import engine;
|
|
|
|
fn _makeChild(parent: opaque, fname: string, init: bool) {
|
|
var child: opaque = loadNode(fname);
|
|
|
|
if (init) {
|
|
child.initNode();
|
|
}
|
|
|
|
parent.pushNode(child);
|
|
}
|
|
|
|
//root node can load the whole scene, and essentially act as the scene object
|
|
fn onInit(node: opaque) {
|
|
print "root.toy:onInit() called";
|
|
|
|
//make a child
|
|
node.makeChild("assets/scripts/child.toy", true); //indicate whether to call "init" on the new node or not
|
|
node.makeChild("assets/scripts/child.toy", false);
|
|
node.makeChild("assets/scripts/child.toy", false);
|
|
|
|
//actually, grab that first node and free it
|
|
node.freeChildNode(0); //must be done from the parent node, so it's pointer can be nullified
|
|
}
|
|
|
|
fn onStep(node: opaque) {
|
|
print clock();
|
|
}
|
|
|
|
fn onFree(node: opaque) {
|
|
print "root.toy:onFree() called";
|
|
}
|