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 est le pack à avoir si vous voulez facilement connaitre l'état des différents input de l'appareil.
Il n'est plus nécessaire d'implémenter les handlers de la souris, du clavier ou du joypad pour connaitre l'état de ces différentes sources. JPInput fourni des fontions que vous pouvez appeler de n'importe où qui vont vous donner ces valeurs.
Par exemple :
--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 : JPInput peut également fournir les valeurs liées au multi touch. Cette fonctionalité requiert le pack JPMultiTouch.