Skip to content

bandinopla/bandijoystick

Repository files navigation

npm version tests

✨💻🐶📱✨ BandiJoystick.js

Turn a phone into a remote controller! No apps. No installations. Just scan & play!

👉 DEMOS + DOCS 👈

BandiJoystick.js is a tiny wrapper library around Trystero to easily allow any phone to be used as a joystick or remote control for your applications / games.

Usage

import * as BANDI from 'bandijoystick';

const input = new BANDI.Joystick( "Player 1" );

// add some buttons!
input.setKeys( [
	new BANDI.PushKey({
		id:"myCoolBtn",
		radius:"200px",
		onClicked: ()=>console.log("YEEEHH HAAAAAA!")
	})
]);

// listen...
input.connected.on(()=>console.log("Player 1 has joined da game, ya'll!!!"));

//add it to the page
input.domElement().then( el => document.body.appendChild(el) ); 

Motivation

Sometimes I would like to be able to control an app with the phone acting as a remote control, to be able to be on the couch playing a game I made or an app, etc... So that's how the idea came out. It should be trivial ( I said to myself ) to use the phone to control things... why not just scan a QR code and that's it? No apps, no weird setup. That's what this aims to be.

Possible applications

  • For games: Control the character of your game with your phone or maybe make the phone have some extra buttons to simulate a vehicle's control command? a drone?
  • For conferences: the speaker can just scan the QR code and gain control of some presentation app easily with no setup.
  • For training: Training at home or at a gym? Share the laptop's screen to a big TV on the wall and use your phone to control it so everyone can see some big stopwatch or timer.
  • For events: Share a laptop's screen to a big tv and let people scan the code to register themselves or to get info about their reservation / table / whatever...
  • A restaurant: Maybe people can scan a qr code to be provided with buttons to call for the waitress or more food, wine, etc...

You do the app, the posibilites are endless!

Open for improvements!

Anyone is free to pull request with improvements and credit will be given! See Adding Examples