36 lines
738 B
Plaintext
36 lines
738 B
Plaintext
//import standard;
|
|
import engine;
|
|
import node;
|
|
|
|
fn _makeChild(parent: opaque, fname: string) {
|
|
var child: opaque = loadNode(fname);
|
|
parent.pushNode(child);
|
|
child.initNode();
|
|
}
|
|
|
|
//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");
|
|
// node.makeChild("assets/scripts/child.toy");
|
|
node.makeChild("assets/scripts/render.toy");
|
|
|
|
print node;
|
|
print node.getNodeChild(0);
|
|
|
|
var o = node.getNodeChild(0);
|
|
print o.callNode("getX");
|
|
|
|
print node.getNodeChild(0).callNode("getX");
|
|
}
|
|
|
|
fn onStep(node: opaque) {
|
|
//print clock();
|
|
}
|
|
|
|
fn onFree(node: opaque) {
|
|
print "root.toy:onFree() called";
|
|
}
|