mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Pointers capped at 10 max.
This commit is contained in:
parent
e6e33f5e21
commit
5313343730
3 changed files with 11 additions and 8 deletions
|
@ -4,8 +4,6 @@
|
|||
|
||||
### Input System New Features + Updates
|
||||
|
||||
TODO - Out of Canvas events
|
||||
|
||||
* All Input classes are now covered 100% by JSDocs.
|
||||
* The Input Manager and Input Plugin have been updated to support multiple simultaneous Pointers. Before, only one active pointer (mouse or touch) was supported. Now, you can have as many active pointers as you need, allowing for complex multi-touch games. These are stored in the Input Manager `pointers` array.
|
||||
* `addPointer` allows you to add one, or more, new pointers to the Input Manager. There is no hard-coded limit to the amount you can have, although realistically you should never need more than 10. This method is available on both the Input Manager and Plugin, allowing you to use `this.input.addPointer` from within your game code.
|
||||
|
|
|
@ -687,7 +687,7 @@ var InputManager = new Class({
|
|||
* By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`.
|
||||
*
|
||||
* You can create more either by calling this method, or by setting the `input.activePointers` property
|
||||
* in the Game Config.
|
||||
* in the Game Config, up to a maximum of 10 pointers.
|
||||
*
|
||||
* The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added
|
||||
* via this method.
|
||||
|
@ -695,7 +695,7 @@ var InputManager = new Class({
|
|||
* @method Phaser.Input.InputManager#addPointer
|
||||
* @since 3.10.0
|
||||
*
|
||||
* @param {integer} [quantity=1] The number of new Pointers to create.
|
||||
* @param {integer} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total.
|
||||
*
|
||||
* @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created.
|
||||
*/
|
||||
|
@ -705,6 +705,11 @@ var InputManager = new Class({
|
|||
|
||||
var output = [];
|
||||
|
||||
if (this.pointersTotal + quantity > 10)
|
||||
{
|
||||
quantity = 10 - this.pointersTotal;
|
||||
}
|
||||
|
||||
for (var i = 0; i < quantity; i++)
|
||||
{
|
||||
var id = this.pointers.length;
|
||||
|
|
|
@ -295,7 +295,7 @@ var InputPlugin = new Class({
|
|||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [] };
|
||||
this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] };
|
||||
|
||||
/**
|
||||
* A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID.
|
||||
|
@ -305,7 +305,7 @@ var InputPlugin = new Class({
|
|||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this._over = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [] };
|
||||
this._over = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] };
|
||||
|
||||
/**
|
||||
* A list of valid DOM event types.
|
||||
|
@ -1942,7 +1942,7 @@ var InputPlugin = new Class({
|
|||
* By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`.
|
||||
*
|
||||
* You can create more either by calling this method, or by setting the `input.activePointers` property
|
||||
* in the Game Config.
|
||||
* in the Game Config, up to a maximum of 10 pointers.
|
||||
*
|
||||
* The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added
|
||||
* via this method.
|
||||
|
@ -1950,7 +1950,7 @@ var InputPlugin = new Class({
|
|||
* @method Phaser.Input.InputPlugin#addPointer
|
||||
* @since 3.10.0
|
||||
*
|
||||
* @param {integer} [quantity=1] The number of new Pointers to create.
|
||||
* @param {integer} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total.
|
||||
*
|
||||
* @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue