The following functions now return the press duration if the key/button is pressed:
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.
--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 )
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.