Rendering is working

This commit is contained in:
2022-10-13 23:50:57 +01:00
parent 500983358d
commit dfcdaf3b92
10 changed files with 527 additions and 9 deletions

17
assets/scripts/render.toy Normal file
View File

@@ -0,0 +1,17 @@
import render;
fn onInit(node: opaque) {
node.loadTextureRenderNode("assets/sprites/character.png");
}
fn onStep(node: opaque) {
//
}
fn onFree(node: opaque) {
node.freeTextureRenderNode();
}
fn onDraw(node: opaque) {
node.drawRenderNode(50, 50);
}

View File

@@ -1,5 +1,6 @@
import standard;
import engine;
import render;
fn _makeChild(parent: opaque, fname: string, init: bool) {
var child: opaque = loadNode(fname);
@@ -13,21 +14,25 @@ fn _makeChild(parent: opaque, fname: string, init: bool) {
//root node can load the whole scene, and essentially act as the scene object
fn onInit(node: opaque) {
print "root.toy:onInit() called";
//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);
//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
//node.freeChildNode(0); //must be done from the parent node, so it's pointer can be nullified
var r = loadRenderNode("assets/scripts/render.toy");
node.pushNode(r);
}
fn onStep(node: opaque) {
print clock();
//print clock();
}
fn onFree(node: opaque) {
print "root.toy:onFree() called";
//print "root.toy:onFree() called";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B