Class Input
- Namespace
- MohawkGame2D
- Assembly
- GAME 10003 Game Development Foundations - 2D Game Template.dll
Access player input functions.
public static class Input
- Inheritance
-
Input
- Inherited Members
Remarks
A static wrapper to standardize raylib's gamepad API.
Methods
DisableMouseCursor()
Disables mouse cursor while in window.
public static void DisableMouseCursor()
EnableMouseCursor()
Enables mouse cursor while in window.
public static void EnableMouseCursor()
GetAnyControllerAxis(ControllerAxis, float)
Get the controllerAxis
value of any controller.
Minimum value to register activity is defined by deadzone
.
public static float GetAnyControllerAxis(ControllerAxis controllerAxis, float deadzone = 0.05)
Parameters
controllerAxis
ControllerAxisThe controller axis to check.
deadzone
floatThe minimum value needed to register an axis value.
Returns
- float
Returns average value of all active controller's
controllerAxis
.
GetAxis(KeyboardInput, KeyboardInput)
Create an axis from specified inputs.
public static float GetAxis(KeyboardInput negative, KeyboardInput positive)
Parameters
negative
KeyboardInputThe negative input key.
positive
KeyboardInputThe positive input key.
Returns
- float
Returns a float axis that combines both inputs, ranges from -1f to +1f.
GetAxis2(KeyboardInput, KeyboardInput, KeyboardInput, KeyboardInput)
Create two axes from specified inputs.
public static Vector2 GetAxis2(KeyboardInput negativeX, KeyboardInput positiveX, KeyboardInput negativeY, KeyboardInput positiveY)
Parameters
negativeX
KeyboardInputThe negative X input key.
positiveX
KeyboardInputThe positive X input key.
negativeY
KeyboardInputThe negative Y input key.
positiveY
KeyboardInputThe positive Y input key.
Returns
- Vector2
Returns a Vector2 axis that combines both X inputs, both Y inputs, each ranging from -1f to +1f. The input is clamped to a max length of 1f.
GetCharsPressed()
Get keyboard char characters pressed. Call multiple times to get queued characters.
public static char GetCharsPressed()
Returns
- char
The character pressed if present, otherwise '\0' (null character) when the queue is empty.
GetConnectedControllerCount()
Get number of controllers connected to the host device.
public static int GetConnectedControllerCount()
Returns
- int
Returns number of controllers connected to this device.
GetControllerAxis(int, ControllerAxis)
Get the controllerAxis
value of
controllerIndex
.
public static float GetControllerAxis(int controllerIndex, ControllerAxis controllerAxis)
Parameters
controllerIndex
intWhich controller to check.
controllerAxis
ControllerAxisThe controller axis to check.
Returns
- float
Returns a value 0-1 of specified controller.
GetMouseDeltaPosition()
Gets the movement of mouse between last frame and this frame.
public static Vector2 GetMouseDeltaPosition()
Returns
- Vector2
Returns the pixel delta position between frames.
GetMouseDeltaX()
Gets the movement of mouse X between last frame and this frame.
public static float GetMouseDeltaX()
Returns
- float
Returns the pixel delta position X between frames.
GetMouseDeltaY()
Gets the movement of mouse Y between last frame and this frame.
public static float GetMouseDeltaY()
Returns
- float
Returns the pixel delta position Y between frames.
GetMousePosition()
Gets the mouse position on screen this frame.
public static Vector2 GetMousePosition()
Returns
- Vector2
Returns the Vector2 mouse position on screen in pixel coordinates.
GetMouseWheel()
Gets the mouse wheel movement this frame.
public static Vector2 GetMouseWheel()
Returns
- Vector2
Returns the Vector2 mouse wheel movement.
GetMouseWheelX()
Gets the mouse wheel's X movement this frame.
public static float GetMouseWheelX()
Returns
- float
Returns the mouse wheel X movement.
GetMouseWheelY()
Gets the mouse wheel's Y movement this frame.
public static float GetMouseWheelY()
Returns
- float
Returns the mouse wheel Y movement.
GetMouseX()
Gets the mouse X position on screen this frame.
public static float GetMouseX()
Returns
- float
Returns the X mouse position on screen in pixel coordinates.
GetMouseY()
Gets the mouse Y position on screen this frame.
public static float GetMouseY()
Returns
- float
Returns the mouse Y position on screen in pixel coordinates.
HideMouseCursor()
Hides mouse cursor in window.
public static void HideMouseCursor()
IsAnyControllerButtonDown(ControllerButton)
Checks if controller number controllerButton
is down on any controller this frame.
public static bool IsAnyControllerButtonDown(ControllerButton controllerButton)
Parameters
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
of any controller is down this frame, false otherwise.
IsAnyControllerButtonPressed(ControllerButton)
Checks if controller number controllerButton
was pressed on any controller this frame.
public static bool IsAnyControllerButtonPressed(ControllerButton controllerButton)
Parameters
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
of any controller was pressed this frame, false otherwise.
IsAnyControllerButtonReleased(ControllerButton)
Checks if controller number controllerButton
was released on any controller this frame.
public static bool IsAnyControllerButtonReleased(ControllerButton controllerButton)
Parameters
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
of any controller was releaed this frame, false otherwise.
IsAnyControllerButtonUp(ControllerButton)
Checks if controller number controllerButton
is up on any controller this frame.
public static bool IsAnyControllerButtonUp(ControllerButton controllerButton)
Parameters
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
of any controller is up this frame, false otherwise.
IsControllerAvailable(int)
Checks to see if controller number controllerIndex
is connected to the host device.
public static bool IsControllerAvailable(int controllerIndex)
Parameters
controllerIndex
intWhich controller to check availability of.
Returns
- bool
Returns true if controller is connected, false otherwise.
IsControllerButtonDown(int, ControllerButton)
Checks if controller number controllerIndex
's
controllerButton
is down this frame.
public static bool IsControllerButtonDown(int controllerIndex, ControllerButton controllerButton)
Parameters
controllerIndex
intWhich controller to check.
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
ofcontrollerIndex
is down this frame, false otherwise.
IsControllerButtonPressed(int, ControllerButton)
Checks if controller number controllerIndex
's
controllerButton
was pressed this frame.
public static bool IsControllerButtonPressed(int controllerIndex, ControllerButton controllerButton)
Parameters
controllerIndex
intWhich controller to check.
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
ofcontrollerIndex
was pressed this frame, false otherwise.
IsControllerButtonReleased(int, ControllerButton)
Checks if controller number controllerIndex
's
controllerButton
was released this frame.
public static bool IsControllerButtonReleased(int controllerIndex, ControllerButton controllerButton)
Parameters
controllerIndex
intWhich controller to check.
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
ofcontrollerIndex
was released this frame, false otherwise.
IsControllerButtonUp(int, ControllerButton)
Checks if controller number controllerIndex
's
controllerButton
is up this frame.
public static bool IsControllerButtonUp(int controllerIndex, ControllerButton controllerButton)
Parameters
controllerIndex
intWhich controller to check.
controllerButton
ControllerButtonThe controller button to check.
Returns
- bool
Returns true if
controllerButton
ofcontrollerIndex
is up this frame, false otherwise.
IsKeyboardKeyDown(KeyboardInput)
Checks if keyboard key is down this frame.
public static bool IsKeyboardKeyDown(KeyboardInput key)
Parameters
key
KeyboardInputThe keyboard key to check.
Returns
- bool
Returns true if key is down this frame, false otherwise.
IsKeyboardKeyPressed(KeyboardInput)
Checks if keyboard key was pressed this frame.
public static bool IsKeyboardKeyPressed(KeyboardInput key)
Parameters
key
KeyboardInputThe keyboard key to check.
Returns
- bool
Returns true if key was pressed this frame, false otherwise.
IsKeyboardKeyReleased(KeyboardInput)
Checks if keyboard key was released this frame.
public static bool IsKeyboardKeyReleased(KeyboardInput key)
Parameters
key
KeyboardInputThe keyboard key to check.
Returns
- bool
Returns true if key was released this frame, false otherwise.
IsKeyboardKeyUp(KeyboardInput)
Checks if keyboard key is up this frame.
public static bool IsKeyboardKeyUp(KeyboardInput key)
Parameters
key
KeyboardInputThe keyboard key to check.
Returns
- bool
Returns true if key is up this frame, false otherwise.
IsMouseButtonDown(MouseInput)
Checks if mouse button is down this frame.
public static bool IsMouseButtonDown(MouseInput button)
Parameters
button
MouseInputThe mouse button to check.
Returns
- bool
Returns true if mouse button is down this frame, false otherwise.
IsMouseButtonPressed(MouseInput)
Checks if mouse button was pressed this frame.
public static bool IsMouseButtonPressed(MouseInput button)
Parameters
button
MouseInputThe mouse button to check.
Returns
- bool
Returns true if mouse button was pressed this frame, false otherwise.
IsMouseButtonReleased(MouseInput)
Checks if mouse button was released this frame.
public static bool IsMouseButtonReleased(MouseInput button)
Parameters
button
MouseInputThe mouse button to check.
Returns
- bool
Returns true if mouse button was released this frame, false otherwise.
IsMouseButtonUp(MouseInput)
Checks if mouse button is up this frame.
public static bool IsMouseButtonUp(MouseInput button)
Parameters
button
MouseInputThe mouse button to check.
Returns
- bool
Returns true if mouse button is up this frame, false otherwise.
IsMouseCursorHidden()
Check if the mouse is hidden.
public static bool IsMouseCursorHidden()
Returns
- bool
Returns true if mouse is hidden, false otherwise.
IsMouseCursorOnScreen()
Checks if the mouse is inside the window.
public static bool IsMouseCursorOnScreen()
Returns
- bool
Returns true if mouse is inside the window, false otherwise.
ShowMouseCursor()
Shows mouse cursor in window.
public static void ShowMouseCursor()