import { h, render, Component } from 'preact'; import {ResponsiveGamepad} from '../dist/responsive-gamepad.esm'; import ExamplePlugin from './examplePlugin'; import ResponsiveGamepadState from './state'; import Touchpad from './touchpad'; import './index.css'; // Log onInputsChange to console ResponsiveGamepad.onInputsChange( ResponsiveGamepad.RESPONSIVE_GAMEPAD_INPUTS.SELECT, state => { console.log('demo: onInputsChange SELECT! State:', state); } ); class ResponsiveGamepadDemo extends Component { componentDidMount() { ResponsiveGamepad.addPlugin(ExamplePlugin()); ResponsiveGamepad.enable(); } render() { return (

Responsive Gamepad Demo

Fork me on Github
Version: {ResponsiveGamepad.getVersion()}
This is the example demo for responsive-gamepad. Feel free to test this demo with: Scroll down to see the current state, learn about the api, and test some specific scenarios!

Prevent Default (Keyboard Only)

I am very tall to show off `event.preventDefault()`. E.g arrow keys wont scroll if in the keymap. But typing will work on input type form fields! Also, keyboard shortcuts will also still work (Refresh the page with Ctrl+R or Cmd+R)