Skip to content

Instantly share code, notes, and snippets.

@Kirkman
Last active October 14, 2015 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kirkman/0853cad3deaad373f000 to your computer and use it in GitHub Desktop.
Save Kirkman/0853cad3deaad373f000 to your computer and use it in GitHub Desktop.
Synchronet tileset test
load("sbbsdefs.js");
load("frame.js");
var cols = console.screen_columns;
var rows = console.screen_rows;
var _tiles = [];
var frame = new Frame(
1,
1,
cols,
rows,
WHITE
);
frame.open();
var _xTileCount = 8;
var _yTileCount = 3;
for (var x = 0; x < _xTileCount; x++) {
var newRow = [];
var newFileRow = [];
// Generate row of empty frames
for (var y = 0; y < _yTileCount; y++) {
// push new empty frame into row array
newRow.push(
new Frame(x*16+1, y*16+1, 16, 16, BG_BLACK, frame)
);
newRow[y].transparent = false;
newRow[y].load(js.exec_dir + '/graphics/16x16_tileset.ans');
}
_tiles.push(newRow);
}
while( userInput != "X" && userInput != "Q" ) {
userInput = console.getkey(K_UPPER | K_NOCRLF);
}
Error when loading the .ANS version of the tileset:
Wed Oct 14 2015 10:39 am guardian.synchro.net
Node 1 !JavaScript /sbbs/exec/load/frame.js line 228: out of memory
Error when loading the .BIN version of the tileset:
Wed Oct 14 2015 10:53 am guardian.synchro.net
Node 1 !JavaScript /sbbs/exec/load/frame.js line 1625: out of memory
I used some debug code to figure out the state of things when the program crashes.
When loading the .ANS version of the tileset:
newRow[y].data_width: 17
newRow[y].data_height: 832
x and y values before error: x: 1, y: 1
When loading the .BIN version of the tileset:
newRow[y].data_width: 129
newRow[y].data_height: 112
x and y values before error: x: 1, y: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment