Input Module

The input module provides functions and constants to query the keyboard, mouse or gamepad. It also provides functions to get frame-related timing data.

Functions

Function Description
getDeltaTime() Return the time elapsed since the last frame in milliseconds.
getFrameRate() Return the current GPU frame rate.
getMouseDrag() Return the amount the mouse has moved since the last frame as a Vec2.
getMousePos() Return the current mouse position as a Vec2.
getTime() Return the number of milliseconds since the start of the program.
hasMouseMoved() See if the mouse moved in the last frame.
isButtonDown() See if a keyboard, mouse or gamepad button is down (use the enum below to address to query specific button).
isButtonPressed() See if a keyboard, mouse or gamepad button was pressed (use the enum below to address to query specific button).
isButtonReleased() See if a keyboard, mouse or gamepad button was released (use the enum below to address to query specific button).
isDoubleClicked() See if a keyboard, mouse or gamepad button was double clicked (use the enum below to address to query specific button).

Constants

Constants Description
gamepad buttons gamepadBack, gamepadDpadDown, gamepadDpadLeft, gamepadDpadRight, gamepadDpadUp, gamepadFaceDown, gamepadFaceLeft, gamepadFaceRight, gamepadFaceUp, gamepadL1, gamepadL2, gamepadL3, gamepadLStickDown, gamepadLStickLeft, gamepadLStickRight, gamepadLStickUp, gamepadR1, gamepadR2, gamepadR3, gamepadRStickDown, gamepadRStickLeft, gamepadRStickRight, gamepadRStickUp, gamepadStart
keyboard buttons key0, key1, key2, key3, key4, key5, key6, key7, key8, key9, keyA, keyApostrophe, keyB, keyBackslash, keyBackspace, keyC, keyCapsLock, keyComma, keyD, keyDelete, keyDownArrow, keyE, keyEnd, keyEnter, keyEqual, keyEscape, keyF, keyF1, keyF10, keyF11, keyF12, keyF2, keyF3, keyF4, keyF5, keyF6, keyF7, keyF8, keyF9, keyG, keyGraveAccent, keyH, keyHome, keyI, keyInsert, keyJ, keyK, keyKeypad0, keyKeypad1, keyKeypad2, keyKeypad3, keyKeypad4, keyKeypad5, keyKeypad6, keyKeypad7, keyKeypad8, keyKeypad9, keyKeypadAdd, keyKeypadDecimal, keyKeypadDivide, keyKeypadEnter, keyKeypadEqual, keyKeypadMultiply, keyKeypadSubtract, keyL, keyLeftAlt, keyLeftArrow, keyLeftBracket, keyLeftCtrl, keyLeftShift, keyLeftSuper, keyM, keyMenu, keyMinus, keyN, keyNumLock, keyO, keyP, keyPageDown, keyPageUp, keyPause, keyPeriod, keyPrintScreen, keyQ, keyR, keyRightAlt, keyRightArrow, keyRightBracket, keyRightCtrl, keyRightShift, keyRightSuper, keyS, keyScrollLock, keySemicolon, keySlash, keySpace, keyT, keyTab, keyU, keyUpArrow, keyV, keyW, keyX, keyY, keyZ, modAlt, modCtrl, modShift, modSuper
mouse buttons mouseLeft, mouseMiddle, mouseRight, mouseWheelX, mouseWheelY, mouseX1, mouseX2