mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Added rudimentary Gamepad controller code
This commit is contained in:
parent
281cbdc3a4
commit
ce0d0204ea
3 changed files with 90 additions and 2 deletions
|
|
@ -2,10 +2,11 @@ define([
|
|||
"Game/Core/Control/PlayerController",
|
||||
"Game/Client/Control/KeyboardInput",
|
||||
"Game/Client/Control/Input/MouseInput",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Game/Client/Control/Input/GamepadInput",
|
||||
],
|
||||
|
||||
function (Parent, KeyboardInput, MouseInput, Nc) {
|
||||
function (Parent, KeyboardInput, MouseInput, Nc, GamepadInput) {
|
||||
|
||||
function PlayerController (me) {
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
|||
|
||||
this.keyboardInput = new KeyboardInput(this);
|
||||
this.xyInput = new MouseInput(this);
|
||||
this.gamepadInput = new GamepadInput(this);
|
||||
|
||||
this.ncTokens = [
|
||||
Nc.on(Nc.ns.client.input.xy.change, this.setXY, this),
|
||||
|
|
@ -44,6 +46,10 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
|||
|
||||
PlayerController.prototype = Object.create(Parent.prototype);
|
||||
|
||||
PlayerController.prototype.update = function() {
|
||||
this.gamepadInput.update();
|
||||
};
|
||||
|
||||
PlayerController.prototype.init = function (keys) {
|
||||
|
||||
this.keyboardInput.registerKey(keys.a, 'moveLeft', 'stop');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue