From 1efecf008e7ef07d0d62fc067a8e67457c648114 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Thu, 4 Aug 2011 22:06:22 +0300 Subject: Add debug logging functionality --- catgag.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'catgag.js') diff --git a/catgag.js b/catgag.js index b7bbf96..6a88847 100644 --- a/catgag.js +++ b/catgag.js @@ -38,5 +38,16 @@ Game.handleKeys = function() { window.Game = Game; }(window)); -window.onload = function() { Ticker.setFPS(30); Game.init(); } +window.Log = function(str) { + var ts = Date.now().toString(); + ts = ts.substr(ts.length - 6); + window.LogElem.value = ts + " " + str + "\n" + window.LogElem.value; +} + +window.onload = function() { + window.LogElem = document.getElementById("log"); + window.Log("window.onload()"); + Ticker.setFPS(30); + Game.init(); +} -- cgit v1.2.3