GithubHelp home page GithubHelp logo

carnaux / vue-gamepad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aaronkirkham/vue-gamepad

0.0 1.0 0.0 1.24 MB

๐ŸŽฎ A Vue.js plugin to add gamepad support. Bind any element to trigger a callback when a gamepad button is pressed.

License: MIT License

JavaScript 100.00%

vue-gamepad's Introduction

Vue Gamepad logo

vue-gamepad

A Vue.js plugin to add gamepad support. Bind any element to trigger a callback when a gamepad button is pressed.

Installation

npm/yarn

$ npm install vue-gamepad
# or with yarn
$ yarn add vue-gamepad

CDN

https://unpkg.com/vue-gamepad/dist/vue-gamepad.min.js

Usage

Tell Vue to use the plugin

import Vue from 'vue';
import VueGamepad from 'vue-gamepad';

Vue.use(VueGamepad);

Example usage inside templates:

<button v-gamepad:button-a="callback">Press me!</button>

Constructor Options

Key Description Default Type
analogThreshold Threshold before analog events are triggered. Low values may cause false positives 0.5 Number
buttonMapping List of strings containing button indices Mapping Array
buttonInitialTimeout Time (in milliseconds) until the button will start repeating when held down 200 Number
buttonRepeatTimeout Time (in milliseconds) between each button repeat event when held down 200 Number
injectClasses Add classes to elements which have a gamepad binding true Boolean

Directives

  • v-gamepad - Bind an element to a gamepad action which will fire a callback
    • released modifier - Only fire the callback when the button is released
    • repeat modifier - Repeatedly fire the callback when the button is held
  • v-gamepad-layer - TODO
  • v-gamepad-json - Pass a raw object of buttons, actions and callbacks to bind

License

This project is licensed under the MIT License - see the LICENSE file for details

vue-gamepad's People

Contributors

aaronkirkham avatar davedoesdev avatar dependabot[bot] 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.