JPInput

JPInput

Collects device input sources related values.
Version : 2.0
Price : $20
State : Out

Changelog

v2.0

  • Now compatible with ShiVa 2.0.
  • Plugin API compiled for Mac and Linux in addition to Windows : it will provide API completion in the Script module in ShiVa Editor for each of these operating systems.
  • Now uses a user token instead of an email to activate

v1.5

  • Added function removeUser ( hUser )

v1.4

The following functions now return the press duration if the key/button is pressed:

  • bYes, nDuration = JPInput.isKeyboardKeyDown ( kKeyCode )
  • bYes, nDuration = JPInput.isMouseButtonDown ( nButton )

v1.3

New feature: Smoothed input values, starting with the onJoypadMove values: JPInput.setJoypadMoveSmoothingEnabled ( bEnabled, nOptCoef ) To get the smoothed values, implement the onJoypadMoveSmoothed handler, same parameters as the original onJoypadMove.

v1.2

  • Optimized for ShiVa 1.9.2

v1.1

  • function JPInput.getMouseAverage changed to: nAverageSpeedX, nAverageSpeedY = JPInput.getMouseAverageSpeed ( )

API

--JPInput JPInput.activate ( sUserToken, sActivationKey ) JPInput.addUser ( hUser ) JPInput.removeUser ( hUser ) --RETRIEVE VALUES --Mouse x, y = JPInput.getCursorPosition ( hOptUser ) bYes, nDuration = JPInput.isMouseButtonDown ( hOptUser, nButton ) nAverageSpeedX, nAverageSpeedY = JPInput.getMouseAverageSpeed ( hOptUser ) --Keyboard bYes, nDuration = JPInput.isKeyboardKeyDown ( hOptUser, kKeyCode ) --Joypad nPressure = JPInput.getJoypadButtonPressure ( hOptUser, nJoypad, nButton ) bState = JPInput.getJoypadButtonState ( hOptUser, nJoypad, nButton ) nPointX, nPointY, nDeltaX, nDeltaY, nRayPntX, nRayPntY, nRayPntZ, nRayDirX, nRayDirY, nRayDirZ = JPInput.getJoypadIRPointerState ( hOptUser, nJoypad, nPointer ) nX0, nY0, nS0, nX1, nY1, nS1, nX2, nY2, nS2, nX3, nY3, nS3 = JPInput.getJoypadIRState ( hOptUser, nJoypad, nSensor ) nAxisX, nAxisY, nAxisZ = JPInput.getJoypadState ( hOptUser, nJoypad, nPart ) nAxisX, nAxisY = JPInput.getJoypadStickState ( hOptUser, nJoypad, nStick ) --MultiTouch (requires JPMultiTouch) bTouching, nPositionX, nPositionY = JPInput.getTouchInputState ( hOptUser, nIndex ) --SMOOTHED VALUES --Joypad JPInput.setJoypadMoveSmoothingEnabled ( bEnabled, nOptCoef )

Description

JPInput is the pack to have if you want to easily get values about most of the device input sources.

No need to implement mouse, keyboard, joypad handlers to be informed of the sources state anymore. JPInput provides functions you can call from everywhere to get these values.

For instance:

--Mouse bYes = JPInput.isMouseButtonDown ( nButton ) --Keyboard bYes = JPInput.isKeyboardKeyDown ( kKeyCode ) --Joypad bState = JPInput.getJoypadButtonState ( nJoypad, nButton ) nAxisX, nAxisY, nAxisZ = JPInput.getJoypadState ( nJoypad, nPart ) nAxisX, nAxisY = JPInput.getJoypadStickState ( nJoypad, nStick )

Note that JPInput can also provide values about multi touch. This feature requires the JPMultiTouch pack.