Gamepad API polyfill for Cordova/PhoneGap on Android gamepads
  • Java 57%
  • JavaScript 43%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-03-23 11:28:25 +03:00
src/android Rewrite MotionEvent handling 2024-03-23 11:28:25 +03:00
test changed svg ids to match buttons 2018-02-21 22:33:58 +02:00
www Rewrite MotionEvent handling 2024-03-23 11:28:25 +03:00
.gitignore Initial commit 2012-12-24 03:05:45 -08:00
LICENSE.md expose the activity as CordovaActivity 2017-05-16 19:41:03 +03:00
package.json added package 2018-03-13 12:06:15 +02:00
plugin.xml initialize on deviceready event 2017-12-15 00:37:50 +02:00
README.md expose the activity as CordovaActivity 2017-05-16 19:41:03 +03:00

Gamepad buttons plugin for Cordova/PhoneGap

By Vlad Stirbu.

This plugin allows you to use Android gamepads in Cordova/PhoneGap applications.

Adding the plugin to your project

Using Cordova command line interface:

cordova plugin add https://github.com/vstirbu/GamepadButtons

Adjust your MainActivity file from:

import org.apache.cordova.CordovaActivity;

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

to:

import com.vladstirbu.cordova.CordovaActivity;

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

Using the plugin

The javascript API follows the W3C Gamepad API, extended with elements from Mozilla Gamepad API.

Implementation status

Methods

Events

TODO

Currently, the plugin supports only the device's incorporated gamepad. External gamepads not supported.

The following events have not been implemented:

Device experience

The plugin was tested on the following devices:

License

The plugin is available under MIT license.