onGamepadConnect(action: (gamepad: KGamepad)=>void): KEventController

Register an event that runs when a gamepad is connected.

paramaction- The function that runs when quit() is called.

// watch for a controller connecting
onGamepadConnect((gp) => {
    debug.log(`ohhi player ${gp.index + 1}`);
});

returnsThe event controller.

sincev3000.0

kaplay logo

Misc

Layer