0.1.20 • Published 7 years ago

zenpad.js v0.1.20

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Zenpad.js — GamePad for canvas game.

npm.io

wercker status MIT License

The aim of the project is to create an easy to use gamepad library for <canvas>.

Demo

Usage

Prepare DOM for Zenpad.js.

<div id="myZenpad"></div>

Install from script

<script src="zenpad.js"></script>
<script>
var zenpad = new Zenpad('myZenpad');
// ... see below
</script>

Install from require

var Zenpad = require('zenpad.js');
var zenpad = new Zenpad('myZenpad');
// ... see below

General

zenpad.on('touchstartA', function() {
  console.info('touchstartA');
});

zenpad.on('moveStick', function(event) {
  console.info('moveStick', event.x);
});

Method

  • on(eventName:String, handler:Function)

    Use to add events.

  • off(eventName:String, handler:Function)

    Use to remove events.

  • dispose()

    Use to dispose zenpad.

Event

  • touchstartA

    Emit "touchstartA" event when push "A" button.

  • touchendA

    Emit "touchendA" event when pull "A" button.

  • clickA

    This is "touchendA" alias event.

  • touchstartB

    Emit "touchstartB" event when push "B" button.

  • touchendB

    Emit "touchendB" event when pull "B" button.

  • clickB

    This is "touchendB" alias event.

  • moveStick

    Emit "moveStick" event when move stick.

    Property

    • x : It is "x" position of stick.
    • y : It is "y" position of stick.
    • angle : It is the angle where the stick was knocked down.
    • length : It is the distance between the stick and the center.
  • releaseStick

    Emit "releaseStick" event when stick is released.

0.1.20

7 years ago

0.1.19

7 years ago

0.1.18

7 years ago

0.1.17

7 years ago

0.1.15

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.54

7 years ago

0.0.53

7 years ago

0.0.52

7 years ago

0.0.51

7 years ago

0.0.50

7 years ago

0.0.49

7 years ago

0.0.48

7 years ago

0.0.47

7 years ago

0.0.46

7 years ago

0.0.45

7 years ago

0.0.44

7 years ago

0.0.43

7 years ago

0.0.42

7 years ago

0.0.41

7 years ago

0.0.40

7 years ago

0.0.39

7 years ago

0.0.38

7 years ago

0.0.37

7 years ago

0.0.36

7 years ago

0.0.35

7 years ago

0.0.34

7 years ago

0.0.33

7 years ago

0.0.32

7 years ago

0.0.31

7 years ago

0.0.30

7 years ago

0.0.29

7 years ago

0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago