123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- import { Observable } from "../Misc/observable";
- import { Gamepad } from "../Gamepads/gamepad";
- /**
- * Defines supported buttons for XBox360 compatible gamepads
- */
- export declare enum Xbox360Button {
- /** A */
- A = 0,
- /** B */
- B = 1,
- /** X */
- X = 2,
- /** Y */
- Y = 3,
- /** Left button */
- LB = 4,
- /** Right button */
- RB = 5,
- /** Back */
- Back = 8,
- /** Start */
- Start = 9,
- /** Left stick */
- LeftStick = 10,
- /** Right stick */
- RightStick = 11
- }
- /** Defines values for XBox360 DPad */
- export declare enum Xbox360Dpad {
- /** Up */
- Up = 12,
- /** Down */
- Down = 13,
- /** Left */
- Left = 14,
- /** Right */
- Right = 15
- }
- /**
- * Defines a XBox360 gamepad
- */
- export declare class Xbox360Pad extends Gamepad {
- private _leftTrigger;
- private _rightTrigger;
- private _onlefttriggerchanged;
- private _onrighttriggerchanged;
- private _onbuttondown;
- private _onbuttonup;
- private _ondpaddown;
- private _ondpadup;
- /** Observable raised when a button is pressed */
- onButtonDownObservable: Observable<Xbox360Button>;
- /** Observable raised when a button is released */
- onButtonUpObservable: Observable<Xbox360Button>;
- /** Observable raised when a pad is pressed */
- onPadDownObservable: Observable<Xbox360Dpad>;
- /** Observable raised when a pad is released */
- onPadUpObservable: Observable<Xbox360Dpad>;
- private _buttonA;
- private _buttonB;
- private _buttonX;
- private _buttonY;
- private _buttonBack;
- private _buttonStart;
- private _buttonLB;
- private _buttonRB;
- private _buttonLeftStick;
- private _buttonRightStick;
- private _dPadUp;
- private _dPadDown;
- private _dPadLeft;
- private _dPadRight;
- private _isXboxOnePad;
- /**
- * Creates a new XBox360 gamepad object
- * @param id defines the id of this gamepad
- * @param index defines its index
- * @param gamepad defines the internal HTML gamepad object
- * @param xboxOne defines if it is a XBox One gamepad
- */
- constructor(id: string, index: number, gamepad: any, xboxOne?: boolean);
- /**
- * Defines the callback to call when left trigger is pressed
- * @param callback defines the callback to use
- */
- onlefttriggerchanged(callback: (value: number) => void): void;
- /**
- * Defines the callback to call when right trigger is pressed
- * @param callback defines the callback to use
- */
- onrighttriggerchanged(callback: (value: number) => void): void;
- /**
- * Gets the left trigger value
- */
- get leftTrigger(): number;
- /**
- * Sets the left trigger value
- */
- set leftTrigger(newValue: number);
- /**
- * Gets the right trigger value
- */
- get rightTrigger(): number;
- /**
- * Sets the right trigger value
- */
- set rightTrigger(newValue: number);
- /**
- * Defines the callback to call when a button is pressed
- * @param callback defines the callback to use
- */
- onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
- /**
- * Defines the callback to call when a button is released
- * @param callback defines the callback to use
- */
- onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
- /**
- * Defines the callback to call when a pad is pressed
- * @param callback defines the callback to use
- */
- ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
- /**
- * Defines the callback to call when a pad is released
- * @param callback defines the callback to use
- */
- ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
- private _setButtonValue;
- private _setDPadValue;
- /**
- * Gets the value of the `A` button
- */
- get buttonA(): number;
- /**
- * Sets the value of the `A` button
- */
- set buttonA(value: number);
- /**
- * Gets the value of the `B` button
- */
- get buttonB(): number;
- /**
- * Sets the value of the `B` button
- */
- set buttonB(value: number);
- /**
- * Gets the value of the `X` button
- */
- get buttonX(): number;
- /**
- * Sets the value of the `X` button
- */
- set buttonX(value: number);
- /**
- * Gets the value of the `Y` button
- */
- get buttonY(): number;
- /**
- * Sets the value of the `Y` button
- */
- set buttonY(value: number);
- /**
- * Gets the value of the `Start` button
- */
- get buttonStart(): number;
- /**
- * Sets the value of the `Start` button
- */
- set buttonStart(value: number);
- /**
- * Gets the value of the `Back` button
- */
- get buttonBack(): number;
- /**
- * Sets the value of the `Back` button
- */
- set buttonBack(value: number);
- /**
- * Gets the value of the `Left` button
- */
- get buttonLB(): number;
- /**
- * Sets the value of the `Left` button
- */
- set buttonLB(value: number);
- /**
- * Gets the value of the `Right` button
- */
- get buttonRB(): number;
- /**
- * Sets the value of the `Right` button
- */
- set buttonRB(value: number);
- /**
- * Gets the value of the Left joystick
- */
- get buttonLeftStick(): number;
- /**
- * Sets the value of the Left joystick
- */
- set buttonLeftStick(value: number);
- /**
- * Gets the value of the Right joystick
- */
- get buttonRightStick(): number;
- /**
- * Sets the value of the Right joystick
- */
- set buttonRightStick(value: number);
- /**
- * Gets the value of D-pad up
- */
- get dPadUp(): number;
- /**
- * Sets the value of D-pad up
- */
- set dPadUp(value: number);
- /**
- * Gets the value of D-pad down
- */
- get dPadDown(): number;
- /**
- * Sets the value of D-pad down
- */
- set dPadDown(value: number);
- /**
- * Gets the value of D-pad left
- */
- get dPadLeft(): number;
- /**
- * Sets the value of D-pad left
- */
- set dPadLeft(value: number);
- /**
- * Gets the value of D-pad right
- */
- get dPadRight(): number;
- /**
- * Sets the value of D-pad right
- */
- set dPadRight(value: number);
- /**
- * Force the gamepad to synchronize with device values
- */
- update(): void;
- /**
- * Disposes the gamepad
- */
- dispose(): void;
- }
|