shimi
Version:
A JS framework for building complex MIDI applications
35 lines (34 loc) • 2.08 kB
TypeScript
import ButtonInput from './ButtonInput';
import SliderInput from './SliderInput';
import { IGamepad } from './Gamepads';
/**
* The MiscController class allows for modelling a controller of unknown type which shimi doesn't yet have built-in support for.
*
* @category User Inputs
*/
export default class MiscController implements IGamepad {
/** Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable. */
get typeName(): string;
/** The collection of all buttons on the gamepad. */
get buttons(): ButtonInput[];
private _buttons;
/** The collection of all axes on the gamepad. */
get axes(): SliderInput[];
private _axes;
/**
* @param buttonNames The collection of button names which will be used for representing the incoming button data. The button names should be unique, and listed in the order which they will match to button indices. The number of button names defines the number of button states that the MiscController expects to receive with each update.
* @param axisNames The collection of axis names which will be used for representing the incoming axis data. The axis names should be unique, and listed in the order which they will match to axis indices. The number of axis names defines the number of axis states that the MiscController expects to receive with each update.
*/
constructor(buttonNames: Array<string>, axisNames: Array<string>);
/**
* Automatically called by the system, shouldn't be called by consumers of the library. Updates each button and slider on the controller.
* @param deltaMs How many milliseconds since the last update cycle
*/
update(deltaMs: number): void;
/**
* Checks if the passed in Gamepad API object can be matched to this controller, requiring that it have the same number of buttons & axes as were used when the controller was set up.
* @param gamepadObject The Gamepad API object to potentially be matched to.
* @returns
*/
canMatch(gamepadObject: Gamepad): boolean;
}