Add gamepad enabling/disabling
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import inputManager from './inputManager';
|
||||
import layoutManager from '../components/layoutManager';
|
||||
import appSettings from './settings/appSettings';
|
||||
|
||||
/**
|
||||
* Key name mapping.
|
||||
@@ -160,7 +161,7 @@ function attachGamepadScript() {
|
||||
}
|
||||
|
||||
// No need to check for gamepads manually at load time, the eventhandler will be fired for that
|
||||
if (navigator.getGamepads) { /* eslint-disable-line compat/compat */
|
||||
if (navigator.getGamepads && appSettings.enableGamepad()) { /* eslint-disable-line compat/compat */
|
||||
window.addEventListener('gamepadconnected', attachGamepadScript);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,13 @@ import { appRouter } from '../components/appRouter';
|
||||
controller: 'user/profile/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferencescontrols.html',
|
||||
path: 'user/controls/index.html',
|
||||
autoFocus: false,
|
||||
controller: 'user/controls/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferencesdisplay.html',
|
||||
path: 'user/display/index.html',
|
||||
|
||||
@@ -18,6 +18,19 @@ class AppSettings {
|
||||
return this.get('enableAutoLogin') !== 'false';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Enable Gamepad' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Enable Gamepad' or undefined.
|
||||
* @return {boolean} 'Enable Gamepad' state.
|
||||
*/
|
||||
enableGamepad(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableGamepad', val.toString());
|
||||
}
|
||||
|
||||
return this.get('enableGamepad') === 'true';
|
||||
}
|
||||
|
||||
enableSystemExternalPlayers(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('enableSystemExternalPlayers', val.toString());
|
||||
|
||||
Reference in New Issue
Block a user