Function

onGamepadConnect

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

Register an event that runs when a gamepad is connected.

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

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

returns The event controller.

since v3000.0

group Input

subgroup Gamepad

kaplay logo

Components