Giter Site home page Giter Site logo

controls.js's Introduction

controls.js

What's this? Maybe it's faster to understand by having a look at the demo over here: https://xtsoler.github.io/controls.js/

controls.js is a little javascript library that tries to offer on screen controls for your game. The controls will work with keyboard, mouse and a controller if it is properly detected by a compatible broswer.

Fastest way to see how it works is to clone the repository and have a look at the js/main.js file:

const controls = new Controls();

const game = new BrosGame(controls);

game.init();

We create a new Controls object and then feed it to our game constructor, in this case BrosGame which is a simple example game. Then some references to that object are necesary so that the on screen controls are operational and also properly depicted when pressed. Look for comments before references to this.controls object in js/brosGame.js

Still work in progress! So far only tested with a PS5 dual sense controller, works on Chrome on PC as well as on an iPhone in Safari.

controls.js's People

Contributors

xtsoler avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.