Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.
/ crafty-gamepad Public archive

Component for the Crafty HTML5/JavaScript game engine for handling gamepad input devices (unmaintained)

License

Notifications You must be signed in to change notification settings

svenjacobs/crafty-gamepad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No Maintenance Intended

The project is no longer maintained and is looking for a new maintainer!

Component for the Crafty HTML5/JavaScript game engine for handling input events of gamepad devices. Also contains a GamepadMultiway component for moving an entity with a gamepad.

Crafty.e('2D, DOM, Gamepad')
    .gamepad(0)
    .bind('GamepadKeyChange', function (e) {
        console.log('Button ' + e.button + ', Value ' + e.value);
    })
    .bind('GamepadAxisChange', function (e) {
        console.log('Axis ' + e.axis + ', Value ' + e.value);
    });

Crafty.e('2D, DOM, GamepadMultiway') // Entity can be controlled with gamepad
    .gamepadMultiway({
        speed: 100, // Speed is in px/sec
        gamepadIndex: 0
    });

The HTML5 Gamepad API is yet experimental and subject to change. Expect this code to break until the Gamepad API is stable. So far has only been tested with Google Chrome a Xbox 360 controller, a Playstation 3 controller and a Thrustmaster Firestorm Dual Analog III.

Licensed under MIT License.

Crafty support

This version of the component requires Crafty 0.7.0 or higher. (speed is in px/sec and based on the Motion component)

For Gamepad support for Crafty 0.6.x, please use version 0.0.1 of this component. (where speed is in px/frame)

About

Component for the Crafty HTML5/JavaScript game engine for handling gamepad input devices (unmaintained)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published