Replaced polyfills with real implementations

This commit is contained in:
2023-07-30 18:11:19 +10:00
parent a20cfdd13e
commit ad0539be68
9 changed files with 34 additions and 95 deletions

View File

@@ -555,10 +555,4 @@ fn generateSnapshotAt(x: int, y: int) {
}
return result;
}
//polyfill
fn sign(x) {
if (x > 0) return 1;
return -1;
}
}

View File

@@ -34,7 +34,7 @@ fn setTilemap(node: opaque, t: [int]) {
tilemap = t;
//create a child as a render target
var child = node.loadChild("scripts:/tilemap/renderer-child.toy");
var child = node.loadChildNode("scripts:/tilemap/renderer-child.toy");
child.createNodeTexture(CELL_WIDTH * CELL_COUNT_X * TILE_PIXEL_WIDTH, CELL_HEIGHT * CELL_COUNT_Y * TILE_PIXEL_HEIGHT);
setRenderTarget(child);
@@ -66,11 +66,3 @@ fn setTilemap(node: opaque, t: [int]) {
//reset the render target to the screen
setRenderTarget(null);
}
//polyfills
fn loadChild(parent: opaque, fname: string) {
//TODO: add this to the API proper
var child: opaque = loadNode(fname);
parent.pushNode(child);
return child;
}