svelte-gamepad-virtual-joystick Svelte Themes

Svelte Gamepad Virtual Joystick

Gamepad bindings for your svelte web-app with a virtual joystick that can either be used as fallback when a joystick is not connected, as indicator of the gamepad state or to provie a virtual joystick and a gamepad at the same time to your user.

Svelte Gamepad and virtual JoyStick

Svelte library for complex input to your app, provides Gamepad integration with the capability to show a virtual Joystick.

The virtual Joystick can either be used as fallback when a real gamepad is not connected but a touchscreen is present, as indicator of the gamepad state or to provide a virtual joystick to the user.

Also allows keyboard inputs as fallback.

Examples

See the Svelte complex input example-app for usage examples.

Application

This library is used to reimagine the control of robotic systems but can also be useful in web game development prototyping.

Installation

This library can be installed using npm:

npm i -D svelte-gamepad-virtual-joystick

Usage

For usage examples take a look at the Svelte complex input example-app (this app does not exist yet, look at the +page.svelte-file for now) how to use the development build in your project.

Sources

based on code from

  • https://github.com/arturcarvalho/svelte-gamepad/ (I first thought to just use it and updated to use vite and integrate more complex button/axis handling but I also wanted to support more than 4 gamepads, have a virtual joystick and keyboard controls so this became its own thing instead of just a fork)
  • nipple.js (nipple.js itself is not svelte compatible because it directly accesses window)

Deploy to NPM

TODO!

License

BSD-3

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes