New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@arcade2d/controls

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcade2d/controls

Game control input library.

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

Controls

Input detection components for browser-based game controls.

Installation

$ yarn add @arcade2d/controls

Examples

Keyboard Input

import {
  KeyboardInput,
  KeyboardInputEvent,
  KeyboardState,
} from '@arcade2d/controls';

// Define keyboard input manager instance.
const keyboard = new KeyboardInput(document);

// Handle key press and release handlers.
keyboard.onKeyPress((event: KeyboardInputEvent) =>
  console.log('press', event.key),
);
keyboard.onKeyRelease((event: KeyboardInputEvent) =>
  console.log('release', event.key),
);

// Check keyboard state during a loop.
setInterval(() => {
  const state: KeyboardState = keyboard.getState();

  if (state.isDown('a')) {
    console.log('a is held down');
  }
}, 16);

FAQs

Package last updated on 06 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc