Skip to content
Browse files

ensure debug stats are rounded appropriately

  • Loading branch information...
1 parent fb5bec9 commit 639600a22c04fb2fb0f686d68b9581a2fe68884c @jakesgordon committed May 22, 2011
Showing with 4 additions and 5 deletions.
  1. +0 −1 README.md
  2. +4 −4 game.js
View
1 README.md
@@ -9,4 +9,3 @@ This is a small experiment to implement a starfield in an HTML <canvas>.
TODO
====
* 3d mode
- * background nasa nebula picture ?
View
8 game.js
@@ -277,10 +277,10 @@ Game = {
drawStats: function(ctx) {
if (this.cfg.stats) {
ctx.fillStyle = 'white';
- ctx.fillText("frame: " + this.stats.count, this.width - 100, this.height - 60);
- ctx.fillText("fps: " + this.stats.fps, this.width - 100, this.height - 50);
- ctx.fillText("update: " + this.stats.update + "ms", this.width - 100, this.height - 40);
- ctx.fillText("draw: " + this.stats.draw + "ms", this.width - 100, this.height - 30);
+ ctx.fillText("frame: " + Math.round(this.stats.count), this.width - 100, this.height - 60);
+ ctx.fillText("fps: " + Math.round(this.stats.fps), this.width - 100, this.height - 50);
+ ctx.fillText("update: " + Math.round(this.stats.update) + "ms", this.width - 100, this.height - 40);
+ ctx.fillText("draw: " + Math.round(this.stats.draw) + "ms", this.width - 100, this.height - 30);
}
},

0 comments on commit 639600a

Please sign in to comment.
Something went wrong with that request. Please try again.