@snex/react-input-mapper

0.4.0 • Public • Published

SNEX React Input Mapper

A widget that shows a controller on screen and lets the user map visible buttons to keyboard keys. The component comes functional styles included but requires cosmetic styling for your particular project.

Usage

  • Install.
yarn add @snex/react-input-mapper
  • Require component.
import InputMapper from '@snex/react-input-mapper';
  • Setup and render.
<InputMapper
  svgURL='/graphics/nes.svg'
  onInput={({key, state}) => console.log(`Button ${key} is pressed`, state)}
/>

Example style

.App .snex-input-mapper {
    font-size: 2vh;
    margin: 0 auto;
    width: 30vw;
}

.App .snex-input-mapper .key-map {
    background: rgba(0, 0, 0, 0.5);
    border-radius: .2em;
    padding: 1em;
    text-align: left;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @snex/react-input-mapper

Homepage

snex.io

Weekly Downloads

1

Version

0.4.0

License

ISC

Last publish

Collaborators

  • pomle