Stress-testing and working on issues
This commit is contained in:
@@ -5,14 +5,14 @@ import node;
|
||||
var childCounter: int = 0;
|
||||
|
||||
//TODO: reference these from a global source (root?)
|
||||
var tileWidth: int const = 100;
|
||||
var tileHeight: int const = 100;
|
||||
var tileWidth: int const = 64;
|
||||
var tileHeight: int const = 64;
|
||||
|
||||
var roomWidth: int const = 10;
|
||||
var roomHeight: int const = 10;
|
||||
|
||||
var levelXCount: int const = 4;
|
||||
var levelYCount: int const = 4;
|
||||
var levelXCount: int const = 9;
|
||||
var levelYCount: int const = 9;
|
||||
|
||||
|
||||
//util to generate and init a child node of a given parent
|
||||
@@ -42,13 +42,13 @@ fn drawLayer(node: opaque, camX, camY, camW, camH, depth) {
|
||||
|
||||
var tileWidth_mod: int = round(tileWidth * mod);
|
||||
var tileHeight_mod: int = round(tileHeight * mod);
|
||||
var camX_mod: int = round((camX - camW) * mod + camW / 2);
|
||||
var camY_mod: int = round((camY - camH) * mod + camH / 2);
|
||||
var camX_mod: int = round((camX - camW) * mod + camW/2);
|
||||
var camY_mod: int = round((camY - camH) * mod + camH/2);
|
||||
|
||||
//calc the region to render
|
||||
var lowerX: int = round((camX - camW/2) / tileWidth);
|
||||
var lowerX: int = round((camX - camW/2.0) / tileWidth);
|
||||
var upperX: int = round((camX - camW*1.5) / tileWidth);
|
||||
var lowerY: int = round((camY - camH/2) / tileHeight);
|
||||
var lowerY: int = round((camY - camH/2.0) / tileHeight);
|
||||
var upperY: int = round((camY - camH*1.5) / tileHeight);
|
||||
|
||||
//bounds check
|
||||
@@ -64,7 +64,7 @@ fn drawLayer(node: opaque, camX, camY, camW, camH, depth) {
|
||||
continue;
|
||||
}
|
||||
|
||||
node.getChildNode(0).drawNode(round(camX_mod + i * tileWidth_mod), round(camY_mod + j * tileHeight_mod), tileWidth_mod, tileHeight_mod);
|
||||
node.getChildNode(0).drawNode(camX_mod + i * tileWidth_mod, camY_mod + j * tileHeight_mod, tileWidth_mod, tileHeight_mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user