test code to check for font load

This commit is contained in:
Rob Pearce 2016-09-08 13:49:23 +10:00
parent 18cf0704f5
commit 5c9cc8d82b
2 changed files with 18 additions and 6 deletions

View File

@ -1259,6 +1259,19 @@ var game = {
return this.rng.rndrange(min, max);
},
isfontloaded : function() {
var tempctx = this.stargoalbanner.getContext("2d");
var size;
tempctx.font = "50 pt " + FONT;
size = tempctx.measureText("wwwww").width;
console.log(size);
if (size >= 36) {
return true;
}
return false;
},
addfireworks : function() {
var delay = 0;
for (i = 0; i < FIREWORKCOUNT; i++) {
@ -1343,6 +1356,7 @@ var game = {
//this.canvas = document.createElement("canvas");
this.canvas = document.getElementsByTagName('canvas')[0];
this.stargoalbanner = document.createElement("canvas");
this.temp = document.createElement("canvas");
this.hratio = SCREENH / SCREENW;
this.wratio = SCREENW / SCREENH;
@ -7773,7 +7787,10 @@ function mainloop() {
game.drawloader();
if (nimages >= maximages) {
game.setstate("title");
// has font loaded?
if (game.isfontloaded()) {
game.setstate("title");
}
}
} else if (game.state == "help") {
game.clear();

5
todo
View File

@ -34,17 +34,12 @@ arrow/signpost - cat parades bounce off and take out htings in the path
PLAYTEST:
... adjust point goal calculation code now that we have multiplier.
... adjust # of turns per level
foot/human/cat toy - adjacent cat pushes it, clear the horiz. line.
show points for each element along path??