@rbuljan/gamepad
Version:
Multi-touch gamepad with buttons and joystick for JavaScript games, apps, IOT
27 lines • 598 B
JavaScript
import { Controller } from "./controller";
/**
* Gamepad - Button Controller
*/
export class Button extends Controller {
constructor(options) {
super(options, "button");
}
onStart() {
super.onStart();
this.state.value = this.options.spring
? 1
: this.state.isActive
? 1
: 0;
this.onInput();
}
onEnd() {
super.onEnd();
if (!this.options.spring) {
return;
}
this.state.value = 0;
this.onInput();
}
}
//# sourceMappingURL=button.js.map