LuaDocs/UInputManager
From Data Realms Wiki
Has no parent class
Generic Class. The singleton manager over the user input.
Enumerations
Players
- 0 = PLAYER_ONE
- 1 = PLAYER_TWO
- 2 = PLAYER_THREE
- 3 = PLAYER_FOUR
- 4 = MAX_PLAYERS
InputDevice
- 0 = DEVICE_KEYB_ONLY
- 1 = DEVICE_MOUSE_KEYB
- 2 = DEVICE_GAMEPAD_1
- 3 = DEVICE_GAMEPAD_2
- 4 = DEVICE_GAMEPAD_3
- 5 = DEVICE_GAMEPAD_4
- 6 = DEVICE_COUNT
InputElements
- 0 = INPUT_L_UP
- 1 = INPUT_L_DOWN
- 2 = INPUT_L_LEFT
- 3 = INPUT_L_RIGHT
- 4 = INPUT_R_UP
- 5 = INPUT_R_DOWN
- 6 = INPUT_R_LEFT
- 7 = INPUT_R_RIGHT
- 8 = INPUT_FIRE
- 9 = INPUT_AIM
- 10 = INPUT_AIM_UP
- 11 = INPUT_AIM_DOWN
- 12 = INPUT_AIM_LEFT
- 13 = INPUT_AIM_RIGHT
- 14 = INPUT_PIEMENU
- 15 = INPUT_JUMP
- 16 = INPUT_CROUCH
- 17 = INPUT_NEXT
- 18 = INPUT_PREV
- 19 = INPUT_START
- 20 = INPUT_BACK
- 21 = INPUT_COUNT
MouseButtons
- 0 = MOUSE_LEFT
- 1 = MOUSE_RIGHT
- 2 = MOUSE_MIDDLE
- 3 = MAX_MOUSE_BUTTONS
JoyButtons
- 0 = JOY_1
- 1 = JOY_2
- 2 = JOY_3
- 3 = JOY_4
- 4 = JOY_5
- 5 = JOY_6
- 6 = JOY_7
- 7 = JOY_8
- 8 = JOY_9
- 9 = JOY_10
- 10 = JOY_11
- 11 = JOY_12
- 12 = MAX_JOY_BUTTONS
JoyDirections
- 0 = JOYDIR_ONE
- 1 = JOYDIR_TWO
Functions
ElementPressed
Shows whether a specific input element was depressed between the last update and the one previous to it.
Arguments:
- Which player to check, and which element of that player.
Return value:
Pressed or not.
ElementReleased
Shows whether a specific input element was released between the last update and the one previous to it.
Arguments:
- Which player to check, and which element of that player.
Return value:
Pressed or not.
ElementHeld
Shows whether a specific input element was held during the last update.
Arguments:
- Which player to check, and which element of that player.
Return value:
Pressed or not.
KeyPressed
Shows whether a key was depressed between the last update and the one previous to it.
Arguments:
- A const char with the Allegro-defined key enumeration to test.
Return value:
Pressed or not.
KeyReleased
Shows whether a key was released between the last update and the one previous to it.
Arguments:
- A const char with the Allegro-defined key enumeration to test.
Return value:
Released or not.
KeyHeld
Shows whether a key is being held right now.
Arguments:
- A const char with the Allegro-defined key enumeration to test.
Return value:
Held or not.
WhichKeyHeld
Shows the scancode of the keyboard key which is currently down.
Arguments:
- None.
Return value:
The scancode (KEY_SPACE, etc) of the first keyboard key in the keyboard buffer. 0 means none.
MouseButtonPressed
Shows whether a mosue button was depressed between the last update and the one previous to it.
Arguments:
- Which button.
Return value:
Pressed or not.
MouseButtonReleased
Shows whether a mosue button was released between the last update and the one previous to it.
Arguments:
- Which button.
Return value:
Released or not.
MouseButtonHeld
Shows whether a mouse button is being held down right now.
Arguments:
- Which button.
Return value:
Held or not.
MouseWheelMoved
Shows whether a the mouse wheel has been moved past the threshold limit in either direction this frame.
Arguments:
- None.
Return value:
The direction the mouse wheel has been moved which is past tht threshold 0 means not past, negative means moved down, positive means moved up.
JoyButtonPressed
Shows whether a joy button was depressed between the last update and the one previous to it.
Arguments:
- Which joystick to check, and which button on that joystick.
Return value:
Pressed or not.
JoyButtonReleased
Shows whether a joy button was released between the last update and the one previous to it.
Arguments:
- Which joystick to check, and which button on that joystick.
Return value:
Released or not.
JoyButtonHeld
Shows whether a joystick button is being held down right now.
Arguments:
- Which joystick to check, and which button on that joystick.
Return value:
Held or not.
WhichJoyButtonPressed
Shows the first joystick button which was pressed down since last frame.
Arguments:
- Which joystick to check.
Return value:
The first button in the sequence of button enumerations (JOY_1, JOY_2, JOY_3) that is pressed since the previous frame. JOY_NONE means none.
JoyDirectionPressed
Shows whether a joystick axis direction was depressed between the last update and the one previous to it.
Arguments:
- Which joystick, stick, axis and direction to check.
Return value:
Pressed or not.
JoyDirectionReleased
Shows whether a joystick d-pad direction was released between the last update and the one previous to it.
Arguments:
- Which joystick, stick, axis and direction to check.
Return value:
Released or not.
JoyDirectionHeld
Shows whether a joystick axis is being held down in a specific direction right now. Two adjacent directions can be held down to produce diagonals.
Arguments:
- Which joystick, stick, axis and direction to check.
Return value:
Held or not.
AnalogMoveValues
Gets the analog moving values of a specific player's control scheme.
Arguments:
- Which player to get em for.
Return value:
The analog axis values ranging between -1.0 to 1.0, in both axes.
AnalogAimValues
Gets the analog aiming values of a specific player's control scheme.
Arguments:
- Which player to get em for.
Return value:
The analog axis values ranging between -1.0 to 1.0, in both axes.
SetMouseValueMagnitude
Set the mouse's analog emualtion output to be of a specific normalized magnitude.
Arguments:
- The normalized magnitude, between 0 and 1.0.
Return value:
None.
AnalogAxisValue
Gets the normalized value of a certain joystick's stick's axis.
Arguments:
- Which joystick, stick and axis to check.
Return value:
The analog axis value ranging between -1.0 to 1.0, or 0.0 to 1.0 if it's a throttle type control.
AnalogStickValues
Gets the analog values of a certain joystick device stick.
Arguments:
- Which joystick to check, and which stick on that joystick device.
Return value:
The analog axis values ranging between -1.0 to 1.0.
MouseUsedByPlayer
Reports if any, and which player is using the mouse for control at this time.
Arguments:
- None.
Return value:
Which player is using the mouse. If noone is, then -1 is returned;
AnyMouseButtonPress
Return true if there is any mouse button presses at all
Arguments:
- None.
Return value:
Whether any mouse buttons have been pressed at all since last frame
TrapMousePos
Sets the mouse to be trapped in the middle of the screen, so it doesn't go out and click on other windows etc. This is usually used when the cursor is invisible and only relative mouse movements are used.
Arguments:
- Whether to trap the mouse or not.
- Which player is trying ot control the mouse. Only the player with actual control over the mouse will affect its trapping here. -1 means change mouse trapping regardless of player.
Return value:
None.
GetMouseMovement
Gets the relative movement of the mouse since last update. Only returns true if the selected player actuall is using the mouse.
Arguments:
- Which player to get em for. If the player doesn't use the mouse, then this always returns a zero vector.
Return value:
The relative mouse movements, in both axes.
DisableMouseMoving
Will temporarily disable positioniong of the mouse. This is so that when focus is swtiched back to the game window, it avoids having the window fly away because the user clicked the title bar of the window.
Arguments:
- Whether to disable or not.
Return value:
None.
SetMousePos
Sets the absolute screen position of the mouse cursor.
Arguments:
- Where to place the mouse.
- Which player is trying ot control the mouse. Only the player with actual control over the mouse will affect its trapping here. -1 means do it regardless of player.
Return value:
None.
ForceMouseWithinBox
Forces the mouse within a box on the screen.
Arguments:
- The top left corner of the screen box to keep the mouse within, in screen coodinates.
- The dimensions of the box, width/height.
- Which player is trying ot control the mouse. Only the player with actual control over the mouse will affect its trapping here. -1 means do it regardless of player.
Return value:
None.
ForceMouseWithinPlayerScreen
Forces the mouse within a specific player's screen area.
Arguments:
- Which player's screen's are to constrain the mouse to. Only the player with actual control over the mouse will affect its trapping here.
Return value:
None.
AnyJoyInput
Return true if there is any joystick input at all, buttons or d-pad.
Arguments:
- None.
Return value:
Whether any buttons of pads are pressed at all.
AnyJoyPress
Return true if there is any joystick presses at all, buttons or d-pad.
Arguments:
- None.
Return value:
Whether any buttons or pads have been pressed at all since last frame.
AnyJoyButtonPress
Return true if there is any joystick button presses at all, but not d-pad input, for a specific joystick.
Arguments:
- None.
Return value:
Whether any joy buttons have been pressed at all since last frame, of a specific joystick.
AnyInput
Return true if there is any input at all, keyboard or buttons or d-pad.
Arguments:
- None.
Return value:
Whether any buttons of pads are pressed at all.
AnyPress
Return true if there is any key, button, or d-pad presses at all. MUST call Update before calling this for it to work properly!
Arguments:
- None.
Return value:
Whether any buttons of pads have been pressed at all since last frame.
AnyStartPress
Return true if there is any start key/button presses at all. MUST call Update before calling this for it to work properly!
Arguments:
- None.
Return value:
Whether any start buttons or keys have been pressed at all since last frame.