Skip to content

Commit 1d1c4e6

Browse files
committed
Removed all input queue elements
1 parent 186887c commit 1d1c4e6

1 file changed

Lines changed: 9 additions & 155 deletions

File tree

src/input/InputPlugin.js

Lines changed: 9 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -399,16 +399,7 @@ var InputPlugin = new Class({
399399
eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this);
400400
eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this);
401401
eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this);
402-
403-
if (this.manager.useQueue)
404-
{
405-
eventEmitter.on(SceneEvents.UPDATE, this.update, this);
406-
}
407-
else
408-
{
409-
eventEmitter.on(SceneEvents.UPDATE, this.pluginUpdate, this);
410-
}
411-
402+
eventEmitter.on(SceneEvents.UPDATE, this.pluginUpdate, this);
412403
eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this);
413404

414405
this.manager.events.on(Events.GAME_OUT, this.onGameOut, this);
@@ -520,8 +511,8 @@ var InputPlugin = new Class({
520511
},
521512

522513
/**
523-
* The internal update loop for the plugins belong to this Input class.
524-
* Called automatically by the Scene Systems step and only used if `useQueue` is false.
514+
* The internal update loop for the plugins belonging to this Input class.
515+
* Called automatically by the Scene Systems step.
525516
*
526517
* @method Phaser.Input.InputPlugin#pluginUpdate
527518
* @private
@@ -532,6 +523,9 @@ var InputPlugin = new Class({
532523
*/
533524
pluginUpdate: function (time, delta)
534525
{
526+
this.pluginEvents.emit(Events.UPDATE, time, delta);
527+
528+
/*
535529
if (this.pollRate > -1)
536530
{
537531
this.update(time, delta);
@@ -545,11 +539,12 @@ var InputPlugin = new Class({
545539
546540
this.pluginEvents.emit(Events.UPDATE, time, delta);
547541
}
542+
*/
548543
},
549544

550545
/**
551546
* The internal update loop for the Input Plugin.
552-
* Called automatically by the Scene Systems step.
547+
* Called when a DOM Event is processed by the Input Manager.
553548
*
554549
* @method Phaser.Input.InputPlugin#update
555550
* @fires Phaser.Input.Events#UPDATE
@@ -568,34 +563,25 @@ var InputPlugin = new Class({
568563

569564
var manager = this.manager;
570565

571-
this.pluginEvents.emit(Events.UPDATE, time, delta);
566+
// this.pluginEvents.emit(Events.UPDATE, time, delta);
572567

573568
// Another Scene above this one has already consumed the input events, or we're in transition
574569
if (manager.globalTopOnly && manager.ignoreEvents)
575570
{
576571
return;
577572
}
578573

579-
var runUpdate = (manager.dirty || this.pollRate === 0);
580-
581574
if (this.pollRate > 0)
582575
{
583576
this._pollTimer -= delta;
584577

585578
if (this._pollTimer < 0)
586579
{
587-
runUpdate = true;
588-
589580
// Discard timer diff
590581
this._pollTimer = this.pollRate;
591582
}
592583
}
593584

594-
if (!runUpdate)
595-
{
596-
return;
597-
}
598-
599585
var pointers = this.manager.pointers;
600586
var pointersTotal = this.manager.pointersTotal;
601587

@@ -2167,132 +2153,6 @@ var InputPlugin = new Class({
21672153
return this;
21682154
},
21692155

2170-
/**
2171-
* **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true`
2172-
* in your game config, to force it to use the legacy event queue system. This method is deprecated and
2173-
* will be removed in a future version.
2174-
*
2175-
* Adds a callback to be invoked whenever the native DOM `mouseup` or `touchend` events are received.
2176-
* By setting the `isOnce` argument you can control if the callback is called once,
2177-
* or every time the DOM event occurs.
2178-
*
2179-
* Callbacks passed to this method are invoked _immediately_ when the DOM event happens,
2180-
* within the scope of the DOM event handler. Therefore, they are considered as 'native'
2181-
* from the perspective of the browser. This means they can be used for tasks such as
2182-
* opening new browser windows, or anything which explicitly requires user input to activate.
2183-
* However, as a result of this, they come with their own risks, and as such should not be used
2184-
* for general game input, but instead be reserved for special circumstances.
2185-
*
2186-
* If all you're trying to do is execute a callback when a pointer is released, then
2187-
* please use the internal Input event system instead.
2188-
*
2189-
* Please understand that these callbacks are invoked when the browser feels like doing so,
2190-
* which may be entirely out of the normal flow of the Phaser Game Loop. Therefore, you should absolutely keep
2191-
* Phaser related operations to a minimum in these callbacks. For example, don't destroy Game Objects,
2192-
* change Scenes or manipulate internal systems, otherwise you run a very real risk of creating
2193-
* heisenbugs (https://en.wikipedia.org/wiki/Heisenbug) that prove a challenge to reproduce, never mind
2194-
* solve.
2195-
*
2196-
* @method Phaser.Input.InputPlugin#addUpCallback
2197-
* @deprecated
2198-
* @since 3.10.0
2199-
*
2200-
* @param {function} callback - The callback to be invoked on this DOM event.
2201-
* @param {boolean} [isOnce=true] - `true` if the callback will only be invoked once, `false` to call every time this event happens.
2202-
*
2203-
* @return {this} The Input Plugin.
2204-
*/
2205-
addUpCallback: function (callback, isOnce)
2206-
{
2207-
this.manager.addUpCallback(callback, isOnce);
2208-
2209-
return this;
2210-
},
2211-
2212-
/**
2213-
* **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true`
2214-
* in your game config, to force it to use the legacy event queue system. This method is deprecated and
2215-
* will be removed in a future version.
2216-
*
2217-
* Adds a callback to be invoked whenever the native DOM `mousedown` or `touchstart` events are received.
2218-
* By setting the `isOnce` argument you can control if the callback is called once,
2219-
* or every time the DOM event occurs.
2220-
*
2221-
* Callbacks passed to this method are invoked _immediately_ when the DOM event happens,
2222-
* within the scope of the DOM event handler. Therefore, they are considered as 'native'
2223-
* from the perspective of the browser. This means they can be used for tasks such as
2224-
* opening new browser windows, or anything which explicitly requires user input to activate.
2225-
* However, as a result of this, they come with their own risks, and as such should not be used
2226-
* for general game input, but instead be reserved for special circumstances.
2227-
*
2228-
* If all you're trying to do is execute a callback when a pointer is down, then
2229-
* please use the internal Input event system instead.
2230-
*
2231-
* Please understand that these callbacks are invoked when the browser feels like doing so,
2232-
* which may be entirely out of the normal flow of the Phaser Game Loop. Therefore, you should absolutely keep
2233-
* Phaser related operations to a minimum in these callbacks. For example, don't destroy Game Objects,
2234-
* change Scenes or manipulate internal systems, otherwise you run a very real risk of creating
2235-
* heisenbugs (https://en.wikipedia.org/wiki/Heisenbug) that prove a challenge to reproduce, never mind
2236-
* solve.
2237-
*
2238-
* @method Phaser.Input.InputPlugin#addDownCallback
2239-
* @deprecated
2240-
* @since 3.10.0
2241-
*
2242-
* @param {function} callback - The callback to be invoked on this dom event.
2243-
* @param {boolean} [isOnce=true] - `true` if the callback will only be invoked once, `false` to call every time this event happens.
2244-
*
2245-
* @return {this} The Input Plugin.
2246-
*/
2247-
addDownCallback: function (callback, isOnce)
2248-
{
2249-
this.manager.addDownCallback(callback, isOnce);
2250-
2251-
return this;
2252-
},
2253-
2254-
/**
2255-
* **Note:** As of Phaser 3.16 this method is no longer required _unless_ you have set `input.queue = true`
2256-
* in your game config, to force it to use the legacy event queue system. This method is deprecated and
2257-
* will be removed in a future version.
2258-
*
2259-
* Adds a callback to be invoked whenever the native DOM `mousemove` or `touchmove` events are received.
2260-
* By setting the `isOnce` argument you can control if the callback is called once,
2261-
* or every time the DOM event occurs.
2262-
*
2263-
* Callbacks passed to this method are invoked _immediately_ when the DOM event happens,
2264-
* within the scope of the DOM event handler. Therefore, they are considered as 'native'
2265-
* from the perspective of the browser. This means they can be used for tasks such as
2266-
* opening new browser windows, or anything which explicitly requires user input to activate.
2267-
* However, as a result of this, they come with their own risks, and as such should not be used
2268-
* for general game input, but instead be reserved for special circumstances.
2269-
*
2270-
* If all you're trying to do is execute a callback when a pointer is moved, then
2271-
* please use the internal Input event system instead.
2272-
*
2273-
* Please understand that these callbacks are invoked when the browser feels like doing so,
2274-
* which may be entirely out of the normal flow of the Phaser Game Loop. Therefore, you should absolutely keep
2275-
* Phaser related operations to a minimum in these callbacks. For example, don't destroy Game Objects,
2276-
* change Scenes or manipulate internal systems, otherwise you run a very real risk of creating
2277-
* heisenbugs (https://en.wikipedia.org/wiki/Heisenbug) that prove a challenge to reproduce, never mind
2278-
* solve.
2279-
*
2280-
* @method Phaser.Input.InputPlugin#addMoveCallback
2281-
* @deprecated
2282-
* @since 3.10.0
2283-
*
2284-
* @param {function} callback - The callback to be invoked on this dom event.
2285-
* @param {boolean} [isOnce=false] - `true` if the callback will only be invoked once, `false` to call every time this event happens.
2286-
*
2287-
* @return {this} The Input Plugin.
2288-
*/
2289-
addMoveCallback: function (callback, isOnce)
2290-
{
2291-
this.manager.addMoveCallback(callback, isOnce);
2292-
2293-
return this;
2294-
},
2295-
22962156
/**
22972157
* Adds new Pointer objects to the Input Manager.
22982158
*
@@ -2423,14 +2283,8 @@ var InputPlugin = new Class({
24232283
eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this);
24242284
eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this);
24252285
eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this);
2426-
24272286
eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this);
24282287

2429-
if (this.manager.useQueue)
2430-
{
2431-
eventEmitter.off(SceneEvents.UPDATE, this.update, this);
2432-
}
2433-
24342288
this.manager.events.off(Events.GAME_OUT, this.onGameOut, this);
24352289
this.manager.events.off(Events.GAME_OVER, this.onGameOver, this);
24362290

0 commit comments

Comments
 (0)