1.0.5 • Published 4 months ago

com.hydroper.inputaction v1.0.5

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

Input action

Input action library for web applications.

This library allows managing and handling keyboard actions such as shortcuts. It may support gamepads in the future.

Features:

  • Reflect actions
  • Shortcut display text
  • Pooling of pressed keys

Getting started

import { Input } from "com.hydroper.inputaction";

Input.input.setActions({
    "moveLeft": [
        { key: "a" },
        { key: "leftArrow" },
    ],
    "moveRight": [
        { key: "d" },
        { key: "rightArrow" },
    ],
    "moveUp": [
        { key: "w" },
        { key: "upArrow" },
    ],
    "moveDown": [
        { key: "s" },
        { key: "downArrow" },
    ],
});

Input.input.addEventListener("inputPressed", () => {
    // use isPressed() or justPressed()
    const shouldMoveRight = Input.input.justPressed("moveRight");
});
1.0.2

4 months ago

1.0.1

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.0

4 months ago