mirror of
https://github.com/wassname/phaser.git
synced 2026-09-09 11:28:47 +08:00
Added in a Group.sort demo, also updated the documentation and build files.
This commit is contained in:
+62
-20
@@ -242,6 +242,10 @@
|
||||
<a href="Phaser.Pointer.html">Pointer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Polygon.html">Polygon</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.QuadTree.html">QuadTree</a>
|
||||
</li>
|
||||
@@ -404,23 +408,29 @@ Phaser.Mouse = function (game) {
|
||||
this.callbackContext = this.game;
|
||||
|
||||
/**
|
||||
* @property {Description} mouseDownCallback - Description.
|
||||
* @property {function} mouseDownCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.mouseDownCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Description} mouseMoveCallback - Description.
|
||||
* @property {function} mouseMoveCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.mouseMoveCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Description} mouseUpCallback - Description.
|
||||
* @property {function} mouseUpCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.mouseUpCallback = null;
|
||||
|
||||
/**
|
||||
* @property {number} button- The type of click, either: Phaser.Mouse.NO_BUTTON, Phaser.Mouse.LEFT_BUTTON, Phaser.Mouse.MIDDLE_BUTTON or Phaser.Mouse.RIGHT_BUTTON.
|
||||
* @default
|
||||
*/
|
||||
this.button = -1;
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @property {boolean} disabled
|
||||
@@ -435,8 +445,20 @@ Phaser.Mouse = function (game) {
|
||||
*/
|
||||
this.locked = false;
|
||||
|
||||
/**
|
||||
* This event is dispatched when the browser enters or leaves pointer lock state.
|
||||
* @property {Phaser.Signal} pointerLock
|
||||
* @default
|
||||
*/
|
||||
this.pointerLock = new Phaser.Signal;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.NO_BUTTON = -1;
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
@@ -490,7 +512,7 @@ Phaser.Mouse.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* The internal method that handles the mouse down event from the browser.
|
||||
* @method Phaser.Mouse#onMouseDown
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
@@ -498,6 +520,19 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (event.which === 1)
|
||||
{
|
||||
this.button = Phaser.Mouse.LEFT_BUTTON;
|
||||
}
|
||||
else if (event.which === 2)
|
||||
{
|
||||
this.button = Phaser.Mouse.MIDDLE_BUTTON;
|
||||
}
|
||||
else if (event.which === 3)
|
||||
{
|
||||
this.button = Phaser.Mouse.RIGHT_BUTTON;
|
||||
}
|
||||
|
||||
if (this.mouseDownCallback)
|
||||
{
|
||||
this.mouseDownCallback.call(this.callbackContext, event);
|
||||
@@ -515,7 +550,7 @@ Phaser.Mouse.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description
|
||||
* The internal method that handles the mouse move event from the browser.
|
||||
* @method Phaser.Mouse#onMouseMove
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
@@ -540,7 +575,7 @@ Phaser.Mouse.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* The internal method that handles the mouse up event from the browser.
|
||||
* @method Phaser.Mouse#onMouseUp
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
@@ -548,6 +583,8 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
this.button = Phaser.Mouse.NO_BUTTON;
|
||||
|
||||
if (this.mouseUpCallback)
|
||||
{
|
||||
this.mouseUpCallback.call(this.callbackContext, event);
|
||||
@@ -565,7 +602,9 @@ Phaser.Mouse.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* If the browser supports it you can request that the pointer be locked to the browser window.
|
||||
* This is classically known as 'FPS controls', where the pointer can't leave the browser until the user presses an exit key.
|
||||
* If the browser successfully enters a locked state the event Phaser.Mouse.pointerLock will be dispatched and the first parameter will be 'true'.
|
||||
* @method Phaser.Mouse#requestPointerLock
|
||||
*/
|
||||
requestPointerLock: function () {
|
||||
@@ -584,15 +623,15 @@ Phaser.Mouse.prototype = {
|
||||
return _this.pointerLockChange(event);
|
||||
};
|
||||
|
||||
document.addEventListener('pointerlockchange', this._pointerLockChange, false);
|
||||
document.addEventListener('mozpointerlockchange', this._pointerLockChange, false);
|
||||
document.addEventListener('webkitpointerlockchange', this._pointerLockChange, false);
|
||||
document.addEventListener('pointerlockchange', this._pointerLockChange, true);
|
||||
document.addEventListener('mozpointerlockchange', this._pointerLockChange, true);
|
||||
document.addEventListener('webkitpointerlockchange', this._pointerLockChange, true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Internal pointerLockChange handler.
|
||||
* @method Phaser.Mouse#pointerLockChange
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
@@ -604,17 +643,19 @@ Phaser.Mouse.prototype = {
|
||||
{
|
||||
// Pointer was successfully locked
|
||||
this.locked = true;
|
||||
this.pointerLock.dispatch(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pointer was unlocked
|
||||
this.locked = false;
|
||||
this.pointerLock.dispatch(false);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Internal release pointer lock handler.
|
||||
* @method Phaser.Mouse#releasePointerLock
|
||||
*/
|
||||
releasePointerLock: function () {
|
||||
@@ -623,9 +664,9 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
document.exitPointerLock();
|
||||
|
||||
document.removeEventListener('pointerlockchange', this._pointerLockChange);
|
||||
document.removeEventListener('mozpointerlockchange', this._pointerLockChange);
|
||||
document.removeEventListener('webkitpointerlockchange', this._pointerLockChange);
|
||||
document.removeEventListener('pointerlockchange', this._pointerLockChange, true);
|
||||
document.removeEventListener('mozpointerlockchange', this._pointerLockChange, true);
|
||||
document.removeEventListener('webkitpointerlockchange', this._pointerLockChange, true);
|
||||
|
||||
},
|
||||
|
||||
@@ -635,13 +676,14 @@ Phaser.Mouse.prototype = {
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
this.game.stage.canvas.removeEventListener('mousedown', this._onMouseDown);
|
||||
this.game.stage.canvas.removeEventListener('mousemove', this._onMouseMove);
|
||||
this.game.stage.canvas.removeEventListener('mouseup', this._onMouseUp);
|
||||
this.game.stage.canvas.removeEventListener('mousedown', this._onMouseDown, true);
|
||||
this.game.stage.canvas.removeEventListener('mousemove', this._onMouseMove, true);
|
||||
this.game.stage.canvas.removeEventListener('mouseup', this._onMouseUp, true);
|
||||
|
||||
}
|
||||
|
||||
};</pre>
|
||||
};
|
||||
</pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@@ -662,7 +704,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Fri Nov 01 2013 18:16:08 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Thu Nov 07 2013 06:07:33 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user