mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 19:43:28 +00:00
02554984fe
The `KeyboardManager` class has been removed. It has been replaced with `KeyboardPlugin` which is now an Input level plugin, that registers itself with the new `InputPluginCache`. The Input Plugin class (which belongs to a Scene) will now automatically inject registered plugins into itself on boot. Every Scene has its own instance of the Input Plugin (if enabled in the scene plugins), which in turn has its own instance of the KeyboardPlugin. The `InputManager` no longer has any reference to the Keyboard class at all. The benefits of this are two-fold: First, it allows you to now entirely exclude all of the keyboard classes from a custom build, saving a lot of space if not required. Secondly, it means that the Scenes themselves are now responsible for keyboard events, where-as before they were entirely global. This means a Scene can be paused and stop processing keyboard events, and stop having its Key objects updated, while another Scene can still carry on doing this. It also prevents key related callbacks in sleeping Scenes from being fired (which resolves issue #3733, thanks @JoeMoov2)
31 lines
802 B
JavaScript
31 lines
802 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
*/
|
|
|
|
var CONST = require('./const');
|
|
var Extend = require('../utils/object/Extend');
|
|
|
|
/**
|
|
* @namespace Phaser.Input
|
|
*/
|
|
|
|
var Input = {
|
|
|
|
CreateInteractiveObject: require('./CreateInteractiveObject'),
|
|
Gamepad: require('./gamepad'),
|
|
InputManager: require('./InputManager'),
|
|
InputPlugin: require('./InputPlugin'),
|
|
InputPluginCache: require('./InputPluginCache'),
|
|
Keyboard: require('./keyboard'),
|
|
Mouse: require('./mouse'),
|
|
Pointer: require('./Pointer'),
|
|
Touch: require('./touch')
|
|
|
|
};
|
|
|
|
// Merge in the consts
|
|
Input = Extend(false, Input, CONST);
|
|
|
|
module.exports = Input;
|