Skip to content
Browse files

jaws.debug() -> jaws.log(), rhymes better with console.log()

  • Loading branch information...
1 parent b1acc85 commit 475dce8ababc8d57467570f0af9584983d460436 @ippa ippa committed
View
4 examples/example2.html
@@ -23,8 +23,8 @@
<br />We switch active game state with: <code>jaws.switchGameState(a_game_state_or_function)</code>
</div >
- <h3>jaws debug</h3>
- <div id="jaws-debug"></div>
+ <h3>jaws log</h3>
+ <div id="jaws-log"></div>
<script>
View
11 examples/example3.html
@@ -27,8 +27,8 @@
We also use {anchor: "center_bottom"} which means when we paint the sprite at 100/200, the feet will be placed there.
</div>
- <h3>jaws debug</h3>
- <div id="jaws-debug"></div>
+ <h3>jaws log</h3>
+ <div id="jaws-log"></div>
<script>
/*
@@ -74,9 +74,10 @@
jaws.context.lineWidth = 1
jaws.context.moveTo(0,300)
jaws.context.lineTo(jaws.width,300)
- jaws.context.strokeStyle = "black";
- jaws.context.stroke();
-
+ jaws.context.strokeStyle = "black"
+ jaws.context.stroke()
+
+ jaws.log(player)
player.draw()
}
View
4 examples/example4.html
@@ -18,8 +18,8 @@
</div>
- <h3>jaws debug</h3>
- <div id="jaws-debug"></div>
+ <h3>jaws log</h3>
+ <div id="jaws-log"></div>
<script>
function Example4() {
View
4 examples/example5.html
@@ -17,8 +17,8 @@
Showing off the effects of setting different anchors for different sprites.
</div>
- <h3>jaws debug</h3>
- <div id="jaws-debug"></div>
+ <h3>jaws log</h3>
+ <div id="jaws-log"></div>
<script>
function Example5() {
View
4 examples/example7.html
@@ -11,7 +11,7 @@
<br /><br /><br />
<div id="canvas"></div>
- <br /><div id="jaws-debug"></div>
+ <br /><div id="jaws-log"></div>
</body>
<script>
@@ -53,7 +53,7 @@
});
bullets.update()
- jaws.debug("bullets: " + bullets.length + " fps: " + jaws.gameloop.fps)
+ jaws.log("bullets: " + bullets.length + " fps: " + jaws.gameloop.fps)
}
this.draw = function() {
View
6 examples/example8.html
@@ -27,8 +27,8 @@
Once we have the objects in our tile map we can lookup game objects very fast.
</div>
- <h3>jaws debug</h3>
- <div id="jaws-debug"></div>
+ <h3>jaws log</h3>
+ <div id="jaws-log"></div>
<script>
function Example() {
@@ -56,7 +56,7 @@
player = new jaws.Sprite({x:110, y:120, scale: 2, anchor: "center_bottom"})
player.move = function(x, y) {
- jaws.debug("Player: " + player.toRect().toString())
+ jaws.log("Player: " + player.toRect().toString())
// Have our tile map return the items that occupy the cells which are touched by player.rect
// If there's any items inside player.rect, reverse the movement (-> stand still)
View
2 examples/style.css
@@ -7,7 +7,7 @@ h3 { color: #45D4FF; font-size: 25px; }
canvas { border: 1px solid; background: white; margin-top: 150px; }
#canvas { margin: auto; width: 800px; height: 500px; border: black 1px solid; overflow: hidden; background: white; }
#info { width: 500px; line-height: 130%; padding-top: 10px; }
-#jaws-debug { margin: auto; font: 11px verdana; color: #aaaaaa; background: black; width: 500px; padding: 5px; text-align: left; }
+#jaws-log { margin: auto; font: 11px verdana; color: #aaaaaa; background: black; width: 500px; padding: 5px; text-align: left; }
code { font-weight: bold; font-size: 15px; color: white;}
/* We want non-blurry, block retro gfx when scalign! Webkit (chrome/safari) has yet to catch up with this */
View
42 src/core.js
@@ -24,7 +24,7 @@
var jaws = (function(jaws) {
var title
-var debug_tag
+var log_tag
jaws.title = function(value) {
if(value) { return (title.innerHTML = value) }
@@ -43,20 +43,20 @@ jaws.unpack = function() {
var make_global = ["Sprite", "SpriteList", "Animation", "Viewport", "SpriteSheet", "Parallax", "TileMap", "Rect", "pressed"]
make_global.forEach( function(item, array, total) {
- if(window[item]) { jaws.debug(item + "already exists in global namespace") }
+ if(window[item]) { jaws.log(item + "already exists in global namespace") }
else { window[item] = jaws[item] }
});
}
/*
- * Simple debug output, adds text to previously found or created <div id="jaws-debug">
+ * Logger, adds text to previously found or created <div id="jaws-log">
*/
-jaws.debug = function(msg, add) {
- if(debug_tag) {
+jaws.log = function(msg, add) {
+ if(log_tag) {
msg += "<br />"
- if(add) { debug_tag.innerHTML = debug_tag.innerHTML.toString() + msg }
- else { debug_tag.innerHTML = msg }
+ if(add) { log_tag.innerHTML = log_tag.innerHTML.toString() + msg }
+ else { log_tag.innerHTML = msg }
}
}
@@ -67,7 +67,7 @@ jaws.debug = function(msg, add) {
* - jaws.canvas / jaws.context / jaws.dom (our drawable gamearea)
* - jaws.width / jaws.height (width/height of drawable gamearea)
* - jaws.url_parameters (hash of key/values of all parameters in current url)
- * - title / debug_tag (used internally by jaws)
+ * - title / log_tag (used internally by jaws)
*
* */
jaws.init = function(options) {
@@ -76,16 +76,16 @@ jaws.init = function(options) {
jaws.url_parameters = getUrlParameters()
/*
- * If debug=1 parameter is present in the URL, let's either find <div id="jaws-debug"> or create the tag.
- * jaws.debug(message) will use this div for debug/info output to the gamer or developer
+ * If debug=1 parameter is present in the URL, let's either find <div id="jaws-log"> or create the tag.
+ * jaws.log(message) will use this div for debug/info output to the gamer or developer
*
*/
- debug_tag = document.getElementById('jaws-debug')
+ log_tag = document.getElementById('jaws-log')
if(jaws.url_parameters["debug"]) {
- if(!debug_tag) {
- debug_tag = document.createElement("div")
- debug_tag.style.cssText = "overflow: auto; color: #aaaaaa; width: 300px; height: 150px; margin: 40px auto 0px auto; padding: 5px; border: #444444 1px solid; clear: both; font: 10px verdana; text-align: left;"
- document.body.appendChild(debug_tag)
+ if(!log_tag) {
+ log_tag = document.createElement("div")
+ log_tag.style.cssText = "overflow: auto; color: #aaaaaa; width: 300px; height: 150px; margin: 40px auto 0px auto; padding: 5px; border: #444444 1px solid; clear: both; font: 10px verdana; text-align: left;"
+ document.body.appendChild(log_tag)
}
}
@@ -114,10 +114,10 @@ function findOrCreateCanvas() {
jaws.canvas.width = 500
jaws.canvas.height = 300
document.body.appendChild(jaws.canvas)
- debug("creating canvas", true)
+ jaws.log("creating canvas", true)
}
else {
- debug("found canvas", true)
+ jaws.log("found canvas", true)
}
jaws.context = jaws.canvas.getContext('2d');
}
@@ -138,20 +138,20 @@ jaws.start = function(game_state, options) {
var wanted_fps = (options && options.fps) || 60
jaws.init()
- jaws.debug("setupInput()", true)
+ jaws.log("setupInput()", true)
jaws.setupInput()
function assetsLoading(src, percent_done) {
- jaws.debug( percent_done + "%: " + src, true)
+ jaws.log( percent_done + "%: " + src, true)
}
function assetsLoaded() {
- jaws.debug("all assets loaded", true)
+ jaws.log("all assets loaded", true)
jaws.gameloop = new jaws.GameLoop(game_state.setup, game_state.update, game_state.draw, wanted_fps)
jaws.gameloop.start()
}
- jaws.debug("assets.loadAll()", true)
+ jaws.log("assets.loadAll()", true)
if(jaws.assets.length() > 0) { jaws.assets.loadAll({loading: assetsLoading, loaded: assetsLoaded}) }
else { assetsLoaded() }
}
View
4 src/game_loop.js
@@ -27,12 +27,12 @@ jaws.GameLoop = function(setup, update, draw, wanted_fps) {
var that = this
this.start = function() {
- jaws.debug("gameloop start", true)
+ jaws.log("gameloop start", true)
this.current_tick = (new Date()).getTime();
this.last_tick = (new Date()).getTime();
if(setup) { setup() }
update_id = setInterval(this.loop, 1000 / wanted_fps);
- jaws.debug("gameloop loop", true)
+ jaws.log("gameloop loop", true)
}
this.loop = function() {
View
2 src/input.js
@@ -94,7 +94,7 @@ function handleKeyDown(e) {
}
if(prevent_default_keys[human_name]) { e.preventDefault() }
- // jaws.debug(event.type + " - " + event.keyCode + " " + keycode_to_string[event.keyCode]);
+ // jaws.log(event.type + " - " + event.keyCode + " " + keycode_to_string[event.keyCode]);
// e.preventDefault();
}
View
2 src/rect.js
@@ -26,7 +26,7 @@ jaws.Rect.moveTo = function(x,y) {
this.bottom = this.y + this.height
}
-// Draw a red rectangle, usefull for debug
+// Draw a red rectangle, useful for debug
jaws.Rect.prototype.draw = function() {
jaws.context.strokeStyle = "red"
jaws.context.strokeRect(this.x, this.y, this.width, this.height)

0 comments on commit 475dce8

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