Giter VIP home page Giter VIP logo

cordova-plugin-gamepad's Introduction

#cordova-plugin-gamepad

A Cordova plugin to handle the HTML5 gamepad API for iOS and Android. This plugin injects the navigator.getGamepads function into the system along with the gamepadconnected and gamepaddisconnected events into the window event management making any Cordova application to be able to use the underlying game controllers in the system with the same standard API. If the gamepad API is already available (the underlying Cordova webview already supports it) no modifications are made.

##How to use it

###Setup your Cordova project and install the plugin

This plugin has been published in the Cordova Plugin Registry (Plugman) so adding it to any Cordova project version 3.0 and above can be done using the Cordova Command Line Interface (CLI).

  1. Install the Cordova CLI: https://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html

  2. Create a Cordova project and add the desired platforms (remember that this plugin works for iOS and Android for now only): https://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html

  3. Install the plugin with the following command line:

    cordova plugin add https://github.com/TecenGOD/cordova-plugin-gamepad.git

###Modifications in your application

No modifications are needed in your app in order to be able use this plugin. Of course, you need to use the HTML5 Gamepad API as it is shown in the specification (http://www.w3.org/TR/gamepad/).

NOTE: The current version is not 100% compliant with the latest version of the W3C Gamepad API spec. It is based on a previous spec version that did not include the GamepadButton interface, so the recommendation is to use the following conditional when querying for gamepad button data:

	if (typeof gamepad.buttons[j]["value"] !== "undefined")
		value = gamepad.buttons[j]["value"];
	else
		value = gamepad.buttons[j];

##Future improvements

##Additional references

cordova-plugin-gamepad's People

Contributors

husky-koglhof avatar tecengod avatar judax avatar solzimer avatar

Watchers

James Cloos 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.