MCPcopy Create free account
hub / github.com/melonjs/melonJS / bindPointer

Function bindPointer

packages/melonjs/src/input/pointerevent.ts:649–662  ·  view source on GitHub ↗
(...args: number[])

Source from the content-addressed store, hash-verified

647 * me.input.bindPointer(me.input.pointer.RIGHT, me.input.KEY.X);
648 */
649export function bindPointer(...args: number[]): void {
650 const button = args.length < 2 ? pointer.LEFT : args[0];
651 const keyCode = args.length < 2 ? args[0] : args[1];
652
653 // make sure the mouse is initialized
654 enablePointerEvent();
655
656 // throw an exception if no action is defined for the specified keycode
657 if (!getBindingKey(keyCode)) {
658 throw new Error(`no action defined for keycode ${keyCode}`);
659 }
660 // map the mouse button to the keycode
661 pointer.bind[button] = keyCode;
662}
663
664/**
665 * unbind the defined keycode

Callers

nothing calls this directly

Calls 2

getBindingKeyFunction · 0.90
enablePointerEventFunction · 0.85

Tested by

no test coverage detected