user-input

    1.5.1 • Public • Published

    user-input

    User input tracking for keyboard, mouse, touch, and gamepad inputs.

    Usage

    NPM

    Example

    var input   = userInput()
        .withMouse()
        .withKeyboard()
        .withGamepad(0)
        .withTouch()
    
    input.keyboard('A') === 0
    // Press A
    input.keyboard('A') === 1
        
    input.mouse('mouse0') === 0
    // Press Left Mouse Button
    input.mouse('mouse0') === 1
    
    // Get instances of gamepads, in rendering loops.
    input.gamepad()
    
    input.touches        // Current touches
    input.changedTouches // Changed touches
    
    // Clear keyboard & mouse values back to zero.
    input.clear()
    
    // Set values for testing
    input.keyboard('A', 1)
    input.mouse('mouse0', 1)
    input.mouse('x', 500)
    

    Tests

    • Mocha
      • Test functionality in Node.js

    Install

    npm i user-input

    DownloadsWeekly Downloads

    0

    Version

    1.5.1

    License

    MIT

    Unpacked Size

    5.29 kB

    Total Files

    3

    Last publish

    Collaborators

    • avatar