Skip to content
Browse files

Fixed issue #41, but didn't test it.

  • Loading branch information...
1 parent 461c942 commit 5041652449ffca2fb6d7a6ebba1f0f350af81c27 @davidgomes committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/core.js
View
14 src/core.js
@@ -123,7 +123,10 @@ jaws.init = function(options) {
jaws.mouse_x = 0
jaws.mouse_y = 0
+ jaws.mousedown = false;
window.addEventListener("mousemove", saveMousePosition)
+ jaws.canvas.addEventListener("mousedown", onmousedown)
+ jaws.canvas.addEventListener("mouseup", onmouseup)
}
/**
* @private
@@ -139,6 +142,17 @@ function saveMousePosition(e) {
jaws.mouse_y -= game_area.offsetTop
}
+function onmousedown() {
+ jaws.mousedown = true
+}
+function onmouseup() {
+ jaws.mousedown = false
+}
+
+function jaws.mouseDown = function() {
+ return jaws.mousedown
+}
+
/**
* Quick and easy startup of a jaws game loop.
*

0 comments on commit 5041652

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