mirror of
https://github.com/wassname/phaser.git
synced 2026-08-14 12:40:17 +08:00
Input, Loader and Math docs tidied up.
This commit is contained in:
+43
-44
@@ -2,7 +2,6 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.InputHandler
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -14,16 +13,16 @@
|
||||
*/
|
||||
Phaser.InputHandler = function (sprite) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||
*/
|
||||
this.game = sprite.game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Sprite} sprite - Description.
|
||||
*/
|
||||
this.sprite = sprite;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||
*/
|
||||
this.game = sprite.game;
|
||||
|
||||
/**
|
||||
* @property {boolean} enabled - Description.
|
||||
* @default
|
||||
@@ -195,7 +194,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method start
|
||||
* @method Phaser.InputHandler#start
|
||||
* @param {number} priority - Description.
|
||||
* @param {boolean} useHandCursor - Description.
|
||||
* @return {Phaser.Sprite} Description.
|
||||
@@ -253,7 +252,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method reset
|
||||
* @method Phaser.InputHandler#reset
|
||||
*/
|
||||
reset: function () {
|
||||
|
||||
@@ -281,7 +280,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method stop
|
||||
* @method Phaser.InputHandler#stop
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
@@ -301,7 +300,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Clean up memory.
|
||||
* @method destroy
|
||||
* @method Phaser.InputHandler#destroy
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
@@ -317,7 +316,7 @@ Phaser.InputHandler.prototype = {
|
||||
/**
|
||||
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
|
||||
* This value is only set when the pointer is over this Sprite.
|
||||
* @method pointerX
|
||||
* @method Phaser.InputHandler#pointerX
|
||||
* @param {Pointer} pointer
|
||||
* @return {number} The x coordinate of the Input pointer.
|
||||
*/
|
||||
@@ -332,7 +331,7 @@ Phaser.InputHandler.prototype = {
|
||||
/**
|
||||
* The y coordinate of the Input pointer, relative to the top-left of the parent Sprite
|
||||
* This value is only set when the pointer is over this Sprite.
|
||||
* @method pointerY
|
||||
* @method Phaser.InputHandler#pointerY
|
||||
* @param {Pointer} pointer
|
||||
* @return {number} The y coordinate of the Input pointer.
|
||||
*/
|
||||
@@ -346,7 +345,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.
|
||||
* @method pointerDown
|
||||
* @method Phaser.InputHandler#pointerDown
|
||||
* @param {Pointer} pointer
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -360,7 +359,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true
|
||||
* @method pointerUp
|
||||
* @method Phaser.InputHandler#pointerUp
|
||||
* @param {Pointer} pointer
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -374,7 +373,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* A timestamp representing when the Pointer first touched the touchscreen.
|
||||
* @method pointerTimeDown
|
||||
* @method Phaser.InputHandler#pointerTimeDown
|
||||
* @param {Pointer} pointer
|
||||
* @return {number}
|
||||
*/
|
||||
@@ -388,7 +387,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* A timestamp representing when the Pointer left the touchscreen.
|
||||
* @method pointerTimeUp
|
||||
* @method Phaser.InputHandler#pointerTimeUp
|
||||
* @param {Pointer} pointer
|
||||
* @return {number}
|
||||
*/
|
||||
@@ -402,7 +401,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Is the Pointer over this Sprite?
|
||||
* @method pointerOver
|
||||
* @method Phaser.InputHandler#pointerOver
|
||||
* @param {Pointer} pointer
|
||||
* @return {bool
|
||||
*/
|
||||
@@ -416,7 +415,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Is the Pointer outside of this Sprite?
|
||||
* @method pointerOut
|
||||
* @method Phaser.InputHandler#pointerOut
|
||||
* @param {Pointer} pointer
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -430,7 +429,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* A timestamp representing when the Pointer first touched the touchscreen.
|
||||
* @method pointerTimeOver
|
||||
* @method Phaser.InputHandler#pointerTimeOver
|
||||
* @param {Pointer} pointer
|
||||
* @return {number}
|
||||
*/
|
||||
@@ -444,7 +443,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* A timestamp representing when the Pointer left the touchscreen.
|
||||
* @method pointerTimeOut
|
||||
* @method Phaser.InputHandler#pointerTimeOut
|
||||
* @param {Pointer} pointer
|
||||
* @return {number}
|
||||
*/
|
||||
@@ -458,7 +457,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Is this sprite being dragged by the mouse or not?
|
||||
* @method pointerTimeOut
|
||||
* @method Phaser.InputHandler#pointerTimeOut
|
||||
* @param {Pointer} pointer
|
||||
* @return {number}
|
||||
*/
|
||||
@@ -472,7 +471,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Checks if the given pointer is over this Sprite.
|
||||
* @method checkPointerOver
|
||||
* @method Phaser.InputHandler#checkPointerOver
|
||||
* @param {Pointer} pointer
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -510,7 +509,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method checkPixel
|
||||
* @method Phaser.InputHandler#checkPixel
|
||||
* @param {Description} x - Description.
|
||||
* @param {Description} y - Description.
|
||||
* @return {boolean}
|
||||
@@ -543,7 +542,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Update.
|
||||
* @method update
|
||||
* @method Phaser.InputHandler#update
|
||||
* @param {Pointer} pointer
|
||||
*/
|
||||
update: function (pointer) {
|
||||
@@ -576,7 +575,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method _pointerOverHandler
|
||||
* @method Phaser.InputHandler#_pointerOverHandler
|
||||
* @private
|
||||
* @param {Pointer} pointer
|
||||
*/
|
||||
@@ -601,7 +600,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method _pointerOutHandler
|
||||
* @method Phaser.InputHandler#_pointerOutHandler
|
||||
* @private
|
||||
* @param {Pointer} pointer
|
||||
*/
|
||||
@@ -622,7 +621,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method _touchedHandler
|
||||
* @method Phaser.InputHandler#_touchedHandler
|
||||
* @private
|
||||
* @param {Pointer} pointer
|
||||
*/
|
||||
@@ -654,7 +653,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method _releasedHandler
|
||||
* @method Phaser.InputHandler#_releasedHandler
|
||||
* @private
|
||||
* @param {Pointer} pointer
|
||||
*/
|
||||
@@ -694,7 +693,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Updates the Pointer drag on this Sprite.
|
||||
* @method updateDrag
|
||||
* @method Phaser.InputHandler#updateDrag
|
||||
* @param {Pointer} pointer
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -738,7 +737,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
|
||||
* @method justOver
|
||||
* @method Phaser.InputHandler#justOver
|
||||
* @param {Pointer} pointer
|
||||
* @param {number} delay - The time below which the pointer is considered as just over.
|
||||
* @return {boolean}
|
||||
@@ -754,7 +753,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
|
||||
* @method justOut
|
||||
* @method Phaser.InputHandler#justOut
|
||||
* @param {Pointer} pointer
|
||||
* @param {number} delay - The time below which the pointer is considered as just out.
|
||||
* @return {boolean}
|
||||
@@ -770,7 +769,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
|
||||
* @method justPressed
|
||||
* @method Phaser.InputHandler#justPressed
|
||||
* @param {Pointer} pointer
|
||||
* @param {number} delay - The time below which the pointer is considered as just over.
|
||||
* @return {boolean}
|
||||
@@ -786,7 +785,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
|
||||
* @method justReleased
|
||||
* @method Phaser.InputHandler#justReleased
|
||||
* @param {Pointer} pointer
|
||||
* @param {number} delay - The time below which the pointer is considered as just out.
|
||||
* @return {boolean}
|
||||
@@ -802,7 +801,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
|
||||
* @method overDuration
|
||||
* @method Phaser.InputHandler#overDuration
|
||||
* @param {Pointer} pointer
|
||||
* @return {number} The number of milliseconds the pointer has been over the Sprite, or -1 if not over.
|
||||
*/
|
||||
@@ -821,7 +820,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
|
||||
* @method downDuration
|
||||
* @method Phaser.InputHandler#downDuration
|
||||
* @param {Pointer} pointer
|
||||
* @return {number} The number of milliseconds the pointer has been pressed down on the Sprite, or -1 if not over.
|
||||
*/
|
||||
@@ -840,7 +839,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Make this Sprite draggable by the mouse. You can also optionally set mouseStartDragCallback and mouseStopDragCallback
|
||||
* @method enableDrag
|
||||
* @method Phaser.InputHandler#enableDrag
|
||||
* @param lockCenter If false the Sprite will drag from where you click it minus the dragOffset. If true it will center itself to the tip of the mouse pointer.
|
||||
* @param bringToTop If true the Sprite will be bought to the top of the rendering list in its current Group.
|
||||
* @param pixelPerfect If true it will use a pixel perfect test to see if you clicked the Sprite. False uses the bounding box.
|
||||
@@ -881,7 +880,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Stops this sprite from being able to be dragged. If it is currently the target of an active drag it will be stopped immediately. Also disables any set callbacks.
|
||||
* @method disableDrag
|
||||
* @method Phaser.InputHandler#disableDrag
|
||||
*/
|
||||
disableDrag: function () {
|
||||
|
||||
@@ -901,7 +900,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Called by Pointer when drag starts on this Sprite. Should not usually be called directly.
|
||||
* @method startDrag
|
||||
* @method Phaser.InputHandler#startDrag
|
||||
*/
|
||||
startDrag: function (pointer) {
|
||||
|
||||
@@ -932,7 +931,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
|
||||
* @method stopDrag
|
||||
* @method Phaser.InputHandler#stopDrag
|
||||
*/
|
||||
stopDrag: function (pointer) {
|
||||
|
||||
@@ -953,7 +952,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Restricts this sprite to drag movement only on the given axis. Note: If both are set to false the sprite will never move!
|
||||
* @method setDragLock
|
||||
* @method Phaser.InputHandler#setDragLock
|
||||
* @param allowHorizontal To enable the sprite to be dragged horizontally set to true, otherwise false
|
||||
* @param allowVertical To enable the sprite to be dragged vertically set to true, otherwise false
|
||||
*/
|
||||
@@ -970,7 +969,7 @@ Phaser.InputHandler.prototype = {
|
||||
/**
|
||||
* Make this Sprite snap to the given grid either during drag or when it's released.
|
||||
* For example 16x16 as the snapX and snapY would make the sprite snap to every 16 pixels.
|
||||
* @method enableSnap
|
||||
* @method Phaser.InputHandler#enableSnap
|
||||
* @param snapX The width of the grid cell in pixels
|
||||
* @param snapY The height of the grid cell in pixels
|
||||
* @param onDrag If true the sprite will snap to the grid while being dragged
|
||||
@@ -990,7 +989,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Stops the sprite from snapping to a grid during drag or release.
|
||||
* @method disableSnap
|
||||
* @method Phaser.InputHandler#disableSnap
|
||||
*/
|
||||
disableSnap: function () {
|
||||
|
||||
@@ -1001,7 +1000,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Bounds Rect check for the sprite drag
|
||||
* @method checkBoundsRect
|
||||
* @method Phaser.InputHandler#checkBoundsRect
|
||||
*/
|
||||
checkBoundsRect: function () {
|
||||
|
||||
@@ -1027,7 +1026,7 @@ Phaser.InputHandler.prototype = {
|
||||
|
||||
/**
|
||||
* Parent Sprite Bounds check for the sprite drag.
|
||||
* @method checkBoundsSprite
|
||||
* @method Phaser.InputHandler#checkBoundsSprite
|
||||
*/
|
||||
checkBoundsSprite: function () {
|
||||
|
||||
|
||||
@@ -42,21 +42,21 @@ Phaser.Keyboard = function (game) {
|
||||
* @property {boolean} disabled - The disabled state of the Keyboard.
|
||||
* @default
|
||||
*/
|
||||
disabled: false,
|
||||
this.disabled = false;
|
||||
|
||||
/**
|
||||
* @property {function} _onKeyDown
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
_onKeyDown: null,
|
||||
this._onKeyDown = null;
|
||||
|
||||
/**
|
||||
* @property {function} _onKeyUp
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
_onKeyUp: null,
|
||||
this._onKeyUp = null;
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which the callbacks are run.
|
||||
|
||||
+35
-42
@@ -2,10 +2,8 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.MSPointer
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Phaser - MSPointer constructor.
|
||||
*
|
||||
@@ -46,48 +44,43 @@ Phaser.MSPointer = function (game) {
|
||||
*/
|
||||
this.mouseUpCallback = null;
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @property {boolean} disabled
|
||||
*/
|
||||
this.disabled = false;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {Description} _onMSPointerDown
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._onMSPointerDown = null;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {Description} _onMSPointerMove
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._onMSPointerMove = null;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {Description} _onMSPointerUp
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._onMSPointerUp = null;
|
||||
|
||||
};
|
||||
|
||||
Phaser.MSPointer.prototype = {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
game: null,
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @property {boolean} disabled
|
||||
*/
|
||||
disabled: false,
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {Description} _onMSPointerDown
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
_onMSPointerDown: null,
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {Description} _onMSPointerMove
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
_onMSPointerMove: null,
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {Description} _onMSPointerUp
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
_onMSPointerUp: null,
|
||||
|
||||
/**
|
||||
* Starts the event listeners running.
|
||||
* @method start
|
||||
* @method Phaser.MSPointer#start
|
||||
*/
|
||||
start: function () {
|
||||
|
||||
@@ -120,7 +113,7 @@ Phaser.MSPointer.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method onPointerDown
|
||||
* @method Phaser.MSPointer#onPointerDown
|
||||
* @param {Any} event
|
||||
**/
|
||||
onPointerDown: function (event) {
|
||||
@@ -139,7 +132,7 @@ Phaser.MSPointer.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method onPointerMove
|
||||
* @method Phaser.MSPointer#onPointerMove
|
||||
* @param {Any} event
|
||||
**/
|
||||
onPointerMove: function (event) {
|
||||
@@ -158,7 +151,7 @@ Phaser.MSPointer.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method onPointerUp
|
||||
* @method Phaser.MSPointer#onPointerUp
|
||||
* @param {Any} event
|
||||
**/
|
||||
onPointerUp: function (event) {
|
||||
@@ -177,7 +170,7 @@ Phaser.MSPointer.prototype = {
|
||||
|
||||
/**
|
||||
* Stop the event listeners.
|
||||
* @method stop
|
||||
* @method Phaser.MSPointer#stop
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
|
||||
+33
-26
@@ -2,10 +2,8 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.Mouse
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Phaser - Mouse constructor.
|
||||
*
|
||||
@@ -22,7 +20,7 @@ Phaser.Mouse = function (game) {
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} callbackContext - Description.
|
||||
* @property {Object} callbackContext - Description.
|
||||
*/
|
||||
this.callbackContext = this.game;
|
||||
|
||||
@@ -44,36 +42,45 @@ Phaser.Mouse = function (game) {
|
||||
*/
|
||||
this.mouseUpCallback = null;
|
||||
|
||||
};
|
||||
|
||||
Phaser.Mouse.LEFT_BUTTON = 0;
|
||||
Phaser.Mouse.MIDDLE_BUTTON = 1;
|
||||
Phaser.Mouse.RIGHT_BUTTON = 2;
|
||||
|
||||
Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
game: null,
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @property {boolean} disabled
|
||||
* @default
|
||||
*/
|
||||
disabled: false,
|
||||
this.disabled = false;
|
||||
|
||||
/**
|
||||
* If the mouse has been Pointer Locked successfully this will be set to true.
|
||||
* @property {boolean} locked
|
||||
* @default
|
||||
*/
|
||||
locked: false,
|
||||
this.locked = false;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.LEFT_BUTTON = 0;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.MIDDLE_BUTTON = 1;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Mouse.RIGHT_BUTTON = 2;
|
||||
|
||||
Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Starts the event listeners running.
|
||||
* @method start
|
||||
* @method Phaser.Mouse#start
|
||||
*/
|
||||
start: function () {
|
||||
|
||||
@@ -105,7 +112,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method onMouseDown
|
||||
* @method Phaser.Mouse#onMouseDown
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
onMouseDown: function (event) {
|
||||
@@ -128,7 +135,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Description
|
||||
* @method onMouseMove
|
||||
* @method Phaser.Mouse#onMouseMove
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
onMouseMove: function (event) {
|
||||
@@ -151,7 +158,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method onMouseUp
|
||||
* @method Phaser.Mouse#onMouseUp
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
onMouseUp: function (event) {
|
||||
@@ -174,7 +181,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method requestPointerLock
|
||||
* @method Phaser.Mouse#requestPointerLock
|
||||
*/
|
||||
requestPointerLock: function () {
|
||||
|
||||
@@ -201,7 +208,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method pointerLockChange
|
||||
* @method Phaser.Mouse#pointerLockChange
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
pointerLockChange: function (event) {
|
||||
@@ -223,7 +230,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method releasePointerLock
|
||||
* @method Phaser.Mouse#releasePointerLock
|
||||
*/
|
||||
releasePointerLock: function () {
|
||||
|
||||
@@ -239,7 +246,7 @@ Phaser.Mouse.prototype = {
|
||||
|
||||
/**
|
||||
* Stop the event listeners.
|
||||
* @method stop
|
||||
* @method Phaser.Mouse#stop
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
|
||||
+32
-27
@@ -2,7 +2,6 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.Pointer
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -16,6 +15,16 @@
|
||||
*/
|
||||
Phaser.Pointer = function (game, id) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Description} id - Description.
|
||||
*/
|
||||
this.id = id;
|
||||
|
||||
/**
|
||||
* Local private variable to store the status of dispatching a hold event.
|
||||
* @property {boolean} _holdSent
|
||||
@@ -194,16 +203,6 @@ Phaser.Pointer = function (game, id) {
|
||||
*/
|
||||
this.targetObject = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Description} id - Description.
|
||||
*/
|
||||
this.id = id;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @property {boolean} isDown - Description.
|
||||
@@ -240,7 +239,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Called when the Pointer is pressed onto the touchscreen.
|
||||
* @method start
|
||||
* @method Phaser.Pointer#start
|
||||
* @param {Any} event
|
||||
*/
|
||||
start: function (event) {
|
||||
@@ -305,7 +304,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method update
|
||||
* @method Phaser.Pointer#update
|
||||
*/
|
||||
update: function () {
|
||||
|
||||
@@ -342,7 +341,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Called when the Pointer is moved
|
||||
* @method move
|
||||
* @method Phaser.Pointer#move
|
||||
* @param {Any} event
|
||||
*/
|
||||
move: function (event) {
|
||||
@@ -482,7 +481,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Called when the Pointer leaves the target area.
|
||||
* @method leave
|
||||
* @method Phaser.Pointer#leave
|
||||
* @param {Any} event
|
||||
*/
|
||||
leave: function (event) {
|
||||
@@ -494,7 +493,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Called when the Pointer leaves the touchscreen.
|
||||
* @method stop
|
||||
* @method Phaser.Pointer#stop
|
||||
* @param {Any} event
|
||||
*/
|
||||
stop: function (event) {
|
||||
@@ -573,7 +572,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate.
|
||||
* @method justPressed
|
||||
* @method Phaser.Pointer#justPressed
|
||||
* @param {number} [duration]
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -587,7 +586,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate.
|
||||
* @method justReleased
|
||||
* @method Phaser.Pointer#justReleased
|
||||
* @param {number} [duration]
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -601,7 +600,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Resets the Pointer properties. Called by InputManager.reset when you perform a State change.
|
||||
* @method reset
|
||||
* @method Phaser.Pointer#reset
|
||||
*/
|
||||
reset: function () {
|
||||
|
||||
@@ -629,7 +628,7 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
* @method toString
|
||||
* @method Phaser.Pointer#toString
|
||||
* @return {string} A string representation of the instance.
|
||||
**/
|
||||
toString: function () {
|
||||
@@ -640,7 +639,9 @@ Phaser.Pointer.prototype = {
|
||||
|
||||
/**
|
||||
* How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
|
||||
* @return {number}
|
||||
* @name Phaser.Pointer#duration
|
||||
* @property {number} duration - How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Pointer.prototype, "duration", {
|
||||
|
||||
@@ -658,9 +659,11 @@ Object.defineProperty(Phaser.Pointer.prototype, "duration", {
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the X value of this Pointer in world coordinates based on the given camera.
|
||||
* @return {Description}
|
||||
*/
|
||||
* Gets the X value of this Pointer in world coordinates based on the world camera.
|
||||
* @name Phaser.Pointer#worldX
|
||||
* @property {number} duration - The X value of this Pointer in world coordinates based on the world camera.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Pointer.prototype, "worldX", {
|
||||
|
||||
get: function () {
|
||||
@@ -672,9 +675,11 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldX", {
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the Y value of this Pointer in world coordinates based on the given camera.
|
||||
* @return {Description}
|
||||
*/
|
||||
* Gets the Y value of this Pointer in world coordinates based on the world camera.
|
||||
* @name Phaser.Pointer#worldY
|
||||
* @property {number} duration - The Y value of this Pointer in world coordinates based on the world camera.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Pointer.prototype, "worldY", {
|
||||
|
||||
get: function () {
|
||||
|
||||
+67
-75
@@ -2,100 +2,92 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.Touch
|
||||
*/
|
||||
|
||||
/**
|
||||
* Phaser - Touch
|
||||
* Phaser.Touch handles touch events with your game. Note: Android 2.x only supports 1 touch event at once, no multi-touch.
|
||||
*
|
||||
* @class
|
||||
*
|
||||
* @class Phaser.Touch
|
||||
* @classdesc The Touch class handles touch interactions with the game and the resulting Pointer objects.
|
||||
* {@link http://www.w3.org/TR/touch-events/}
|
||||
* {@link https://developer.mozilla.org/en-US/docs/DOM/TouchList}
|
||||
* {@link http://www.html5rocks.com/en/mobile/touchandmouse/}
|
||||
* <p>Note: Android 2.x only supports 1 touch event at once, no multi-touch.
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
*/
|
||||
Phaser.Touch = function (game) {
|
||||
|
||||
/**
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} callbackContext - Description.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @method Phaser.Touch#disabled
|
||||
* @return {boolean}
|
||||
*/
|
||||
this.disabled = false;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} callbackContext - Description.
|
||||
*/
|
||||
this.callbackContext = this.game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} touchStartCallback - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {Phaser.Game} touchStartCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.touchStartCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} touchMoveCallback - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {Phaser.Game} touchMoveCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.touchMoveCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} touchEndCallback - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {Phaser.Game} touchEndCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.touchEndCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} touchEnterCallback - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {Phaser.Game} touchEnterCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.touchEnterCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} touchLeaveCallback - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {Phaser.Game} touchLeaveCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.touchLeaveCallback = null;
|
||||
|
||||
/**
|
||||
* @property {Description} touchCancelCallback - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {Description} touchCancelCallback - Description.
|
||||
* @default
|
||||
*/
|
||||
this.touchCancelCallback = null;
|
||||
|
||||
/**
|
||||
* @property {boolean} preventDefault - Description.
|
||||
* @default
|
||||
/**
|
||||
* @property {boolean} preventDefault - Description.
|
||||
* @default
|
||||
*/
|
||||
this.preventDefault = true;
|
||||
|
||||
this._onTouchStart = null;
|
||||
this._onTouchMove = null;
|
||||
this._onTouchEnd = null;
|
||||
this._onTouchEnter = null;
|
||||
this._onTouchLeave = null;
|
||||
this._onTouchCancel = null;
|
||||
this._onTouchMove = null;
|
||||
|
||||
};
|
||||
|
||||
Phaser.Touch.prototype = {
|
||||
|
||||
game: null,
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @method disabled
|
||||
* @return {boolean}
|
||||
*/
|
||||
disabled: false,
|
||||
|
||||
_onTouchStart: null,
|
||||
_onTouchMove: null,
|
||||
_onTouchEnd: null,
|
||||
_onTouchEnter: null,
|
||||
_onTouchLeave: null,
|
||||
_onTouchCancel: null,
|
||||
_onTouchMove: null,
|
||||
|
||||
/**
|
||||
* Starts the event listeners running.
|
||||
* @method start
|
||||
* @method Phaser.Touch#start
|
||||
*/
|
||||
start: function () {
|
||||
|
||||
@@ -139,8 +131,8 @@ Phaser.Touch.prototype = {
|
||||
|
||||
/**
|
||||
* Consumes all touchmove events on the document (only enable this if you know you need it!).
|
||||
* @method consumeTouchMove
|
||||
**/
|
||||
* @method Phaser.Touch#consumeTouchMove
|
||||
*/
|
||||
consumeDocumentTouches: function () {
|
||||
|
||||
this._documentTouchMove = function (event) {
|
||||
@@ -151,11 +143,11 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Description.
|
||||
* @method onTouchStart
|
||||
* @method Phaser.Touch#onTouchStart
|
||||
* @param {Any} event
|
||||
**/
|
||||
*/
|
||||
onTouchStart: function (event) {
|
||||
|
||||
if (this.touchStartCallback)
|
||||
@@ -183,12 +175,12 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Touch cancel - touches that were disrupted (perhaps by moving into a plugin or browser chrome).
|
||||
* Occurs for example on iOS when you put down 4 fingers and the app selector UI appears.
|
||||
* @method onTouchCancel
|
||||
* @method Phaser.Touch#onTouchCancel
|
||||
* @param {Any} event
|
||||
**/
|
||||
*/
|
||||
onTouchCancel: function (event) {
|
||||
|
||||
if (this.touchCancelCallback)
|
||||
@@ -215,12 +207,12 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* For touch enter and leave its a list of the touch points that have entered or left the target.
|
||||
* Doesn't appear to be supported by most browsers on a canvas element yet.
|
||||
* @method onTouchEnter
|
||||
* @method Phaser.Touch#onTouchEnter
|
||||
* @param {Any} event
|
||||
**/
|
||||
*/
|
||||
onTouchEnter: function (event) {
|
||||
|
||||
if (this.touchEnterCallback)
|
||||
@@ -245,12 +237,12 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* For touch enter and leave its a list of the touch points that have entered or left the target.
|
||||
* Doesn't appear to be supported by most browsers on a canvas element yet.
|
||||
* @method onTouchLeave
|
||||
* @method Phaser.Touch#onTouchLeave
|
||||
* @param {Any} event
|
||||
**/
|
||||
*/
|
||||
onTouchLeave: function (event) {
|
||||
|
||||
if (this.touchLeaveCallback)
|
||||
@@ -270,11 +262,11 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Description.
|
||||
* @method onTouchMove
|
||||
* @method Phaser.Touch#onTouchMove
|
||||
* @param {Any} event
|
||||
**/
|
||||
*/
|
||||
onTouchMove: function (event) {
|
||||
|
||||
if (this.touchMoveCallback)
|
||||
@@ -294,11 +286,11 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Description.
|
||||
* @method onTouchEnd
|
||||
* @method Phaser.Touch#onTouchEnd
|
||||
* @param {Any} event
|
||||
**/
|
||||
*/
|
||||
onTouchEnd: function (event) {
|
||||
|
||||
if (this.touchEndCallback)
|
||||
@@ -321,9 +313,9 @@ Phaser.Touch.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Stop the event listeners.
|
||||
* @method stop
|
||||
* @method Phaser.Touch#stop
|
||||
*/
|
||||
stop: function () {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user