Class Input
Frame based core system for user input from keyboard, mouse and gamepad
Properties
AllowGamepad
True if gamepad is allow to use from game setting
Declaration
public static bool AllowGamepad { get; set; }
AnyGamekeyDown
True if any game-key key start to be holding at current frame
Declaration
public static bool AnyGamekeyDown { get; }
AnyGamekeyHolding
True if any game-key is holding at current frame
Declaration
public static bool AnyGamekeyHolding { get; }
AnyGamepadButtonDown
True if any gamepad button start to be holding at current frame
Declaration
public static bool AnyGamepadButtonDown { get; }
AnyGamepadButtonHolding
True if any gamepad button is holding at current frame
Declaration
public static bool AnyGamepadButtonHolding { get; }
AnyKeyDown
True if any keyboard/gamepad/mouse key start to be holding at current frame
Declaration
public static bool AnyKeyDown { get; }
AnyKeyHolding
True if any keyboard/gamepad/mouse key is holding at current frame
Declaration
public static bool AnyKeyHolding { get; }
AnyKeyboardKeyDown
True if any keyboard key start to be holding at current frame
Declaration
public static bool AnyKeyboardKeyDown { get; }
AnyKeyboardKeyHolding
True if any keyboard key is holding at current frame
Declaration
public static bool AnyKeyboardKeyHolding { get; }
AnyMouseButtonDown
True if any mouse button start to be holding at current frame
Declaration
public static bool AnyMouseButtonDown { get; }
AnyMouseButtonHolding
True if any mouse button is holding at current frame
Declaration
public static bool AnyMouseButtonHolding { get; }
Direction
Direction at current frame from gamekey, d-pad and joystick
Declaration
public static Int2 Direction { get; }
DirectionX
Horizontal direction at current frame from gamekey, d-pad and joystick
Declaration
public static Direction3 DirectionX { get; }
DirectionY
Vertical direction at current frame from gamekey, d-pad and joystick
Declaration
public static Direction3 DirectionY { get; }
HoldingAlt
True if alt key is holding at current frame
Declaration
public static bool HoldingAlt { get; }
HoldingCtrl
True if ctrl key is holding at current frame
Declaration
public static bool HoldingCtrl { get; }
HoldingShift
True if shift key is holding at current frame
Declaration
public static bool HoldingShift { get; }
IgnoringKeyInput
True if the input system do not receive keyboard/game-key input currently
Declaration
public static bool IgnoringKeyInput { get; }
IgnoringMouseInput
True if the input system do not receive mouse input currently
Declaration
public static bool IgnoringMouseInput { get; }
LastActionFromMouse
True if last user action is from mouse instead of keyboard
Declaration
public static bool LastActionFromMouse { get; }
MouseGlobalPosition
Position of the mouse at current frame in global space
Declaration
public static Int2 MouseGlobalPosition { get; }
MouseGlobalPositionDelta
Position changed of the mouse at current frame in global space
Declaration
public static Int2 MouseGlobalPositionDelta { get; }
MouseLeftButtonDown
True if mouse left button start to be holding at current frame
Declaration
public static bool MouseLeftButtonDown { get; }
MouseLeftButtonHolding
True if mouse left button is holding at current frame
Declaration
public static bool MouseLeftButtonHolding { get; }
MouseLeftDownGlobalPosition
Position of the mouse in global space when last time mouse left button press down
Declaration
public static Int2 MouseLeftDownGlobalPosition { get; }
MouseMidButtonDown
True if mouse middle button start to be holding at current frame
Declaration
public static bool MouseMidButtonDown { get; }
MouseMidButtonHolding
True if mouse middle button is holding at current frame
Declaration
public static bool MouseMidButtonHolding { get; }
MouseMidDownGlobalPosition
Position of the mouse in global space when last time mouse middle button press down
Declaration
public static Int2 MouseMidDownGlobalPosition { get; }
MouseMove
True if mouse moved at current frame
Declaration
public static bool MouseMove { get; }
MouseRightButtonDown
True if mouse right button start to be holding at current frame
Declaration
public static bool MouseRightButtonDown { get; }
MouseRightButtonHolding
True if mouse right button is holding at current frame
Declaration
public static bool MouseRightButtonHolding { get; }
MouseRightDownGlobalPosition
Position of the mouse in global space when last time mouse right button press down
Declaration
public static Int2 MouseRightDownGlobalPosition { get; }
MouseScreenPosition
Position of the mouse at current frame in screen space
Declaration
public static Int2 MouseScreenPosition { get; }
MouseScreenPositionDelta
Position changed of the mouse at current frame in screen space
Declaration
public static Int2 MouseScreenPositionDelta { get; }
MouseWheelDelta
Mouse wheel scroll value at current frame. Return negative value when the page scrolls down (the content appears to move upward)
Declaration
public static int MouseWheelDelta { get; }
UnshiftedMouseGlobalPosition
Position changed of the mouse at current frame in global space which is not effect by Input.SetMousePositionShift
Declaration
public static Int2 UnshiftedMouseGlobalPosition { get; }
UsingGamepad
True if the user just used the gamepad
Declaration
public static bool UsingGamepad { get; }
UsingLeftStick
True if the user just used the list joystick
Declaration
public static bool UsingLeftStick { get; }
Methods
CancelIgnoreKeyInput()
Do not ignore key input any more
Declaration
public static void CancelIgnoreKeyInput()
CancelIgnoreMouseInput()
Do not ignore mouse input any more
Declaration
public static void CancelIgnoreMouseInput()
GameKeyDown(Gamekey)
True if given game-key start to be holding at current frame
Declaration
public static bool GameKeyDown(Gamekey key)
GameKeyDownGUI(Gamekey)
True if given game-key pressed down repeatedly by holding down
Declaration
public static bool GameKeyDownGUI(Gamekey key)
GameKeyHolding(Gamekey)
True if given game-key is currently holding
Declaration
public static bool GameKeyHolding(Gamekey key)
GameKeyUp(Gamekey)
True if the given game-key just released at current frame
Declaration
public static bool GameKeyUp(Gamekey key)
GetDefaultGamepadMap(Gamekey)
Get which gamepad-button is default mapping key for given game-key
Declaration
public static GamepadKey GetDefaultGamepadMap(Gamekey key)
GetDefaultKeyboardMap(Gamekey)
Get which keyboard key is default mapping key for given game-key
Declaration
public static KeyboardKey GetDefaultKeyboardMap(Gamekey key)
GetGamepadMap(Gamekey)
Get which gamepad-button is mapping into given game-key
Declaration
public static GamepadKey GetGamepadMap(Gamekey key)
GetHoldingMouseButton()
Get index of the current holding mouse button. (order: left > right > middle)
Declaration
public static int GetHoldingMouseButton()
Returns
Type | Description |
---|---|
int | 0 means left, 1 means right, 2 means middle, -1 means no button holding |
GetKeyboardMap(Gamekey)
Get which keyboard key is mapping into given game-key
Declaration
public static KeyboardKey GetKeyboardMap(Gamekey key)
IgnoreAllInput(int)
Make all user input ignored by the system for given frames long
Declaration
public static void IgnoreAllInput(int duration = 0)
IgnoreKeyInput(int)
Make user keyboard/game-key input ignored by the system for given frames long
Declaration
public static void IgnoreKeyInput(int duration = 0)
IgnoreMouseInput(int)
Make all user mouse input ignored by the system for given frames long
Declaration
public static void IgnoreMouseInput(int duration = 0)
IgnoreMouseToActionJump(bool, bool, bool, int)
Ignore "mouse left to action and mouse right to jump" for given frames long
Declaration
public static void IgnoreMouseToActionJump(bool ignoreAction = true, bool ignoreJump = true, bool useMidButtonAsAction = false, int duration = 1)
IgnoreRightStickToMouseWheel(int)
Ignore "gamepad right stick to control mouse wheel" for given frames long
Declaration
public static void IgnoreRightStickToMouseWheel(int duration = 1)
IsMouseLeftButtonDoubleClick(int)
True if mouse left button performed a double click at current frame
Declaration
public static bool IsMouseLeftButtonDoubleClick(int clickDeltaFrame = 30)
Parameters
Type | Name | Description |
---|---|---|
int | clickDeltaFrame | Two clicks inside this time range count as a double click |
IsMouseMiddleButtonDoubleClick(int)
True if mouse middle button performed a double click at current frame
Declaration
public static bool IsMouseMiddleButtonDoubleClick(int clickDeltaFrame = 30)
Parameters
Type | Name | Description |
---|---|---|
int | clickDeltaFrame | Two clicks inside this time range count as a double click |
IsMouseRightButtonDoubleClick(int)
True if mouse right button performed a double click at current frame
Declaration
public static bool IsMouseRightButtonDoubleClick(int clickDeltaFrame = 30)
Parameters
Type | Name | Description |
---|---|---|
int | clickDeltaFrame | Two clicks inside this time range count as a double click |
KeyboardDown(KeyboardKey)
True if given keyboard-key start to be holding at current frame
Declaration
public static bool KeyboardDown(KeyboardKey key)
KeyboardDownGUI(KeyboardKey)
True if given keyboard-key pressed down repeatedly by holding down
Declaration
public static bool KeyboardDownGUI(KeyboardKey key)
KeyboardHolding(KeyboardKey)
True if given keyboard-key is currently holding
Declaration
public static bool KeyboardHolding(KeyboardKey key)
KeyboardKeyUsed(KeyboardKey)
True if the given keyboard-key is mark as used
Declaration
public static bool KeyboardKeyUsed(KeyboardKey key)
KeyboardUp(KeyboardKey)
True if the given keyboard-key just released at current frame
Declaration
public static bool KeyboardUp(KeyboardKey key)
MouseButtonHolding(int)
True if the given mouse button is holding at current frame
Declaration
public static bool MouseButtonHolding(int button)
Parameters
Type | Name | Description |
---|---|---|
int | button | 0 means left, 1 means right, 2 means middle |
MouseKeyUsed(int)
True if the given mouse button is mark as used
Declaration
public static bool MouseKeyUsed(int key)
Parameters
Type | Name | Description |
---|---|---|
int | key | 0 means left, 1 means right, 2 means middle |
SetGamepadMap(Gamekey, GamepadKey)
Map given gamepad-button into given game-key and save it to disk
Declaration
public static void SetGamepadMap(Gamekey gameKey, GamepadKey gamepadKey)
SetKeyboardMap(Gamekey, KeyboardKey)
Map given keyboard-key into given game-key and save it to disk
Declaration
public static void SetKeyboardMap(Gamekey gameKey, KeyboardKey keyboardKey)
SetMousePositionShift(int, int)
Shift mouse position for current frame. Only effect internal system not where the cursor appearingly is.
Declaration
public static void SetMousePositionShift(int x, int y)
TryGetHoldingGamepadButton(out GamepadKey)
Get the gamepad button that currently holding
Declaration
public static bool TryGetHoldingGamepadButton(out GamepadKey button)
Parameters
Type | Name | Description |
---|---|---|
GamepadKey | button | Result holding button |
Returns
Type | Description |
---|---|
bool | True if holding button founded |
TryGetHoldingKeyboardKey(out KeyboardKey)
Get the keyboard key that currently holding
Declaration
public static bool TryGetHoldingKeyboardKey(out KeyboardKey key)
Parameters
Type | Name | Description |
---|---|---|
KeyboardKey | key | Result holding key |
Returns
Type | Description |
---|---|
bool | True if holding key founded |
UnuseAllMouseKey()
Remove the used mark for all mouse button
Declaration
public static void UnuseAllMouseKey()
UnuseGameKey(Gamekey)
Remove the used mark for given game-key
Declaration
public static void UnuseGameKey(Gamekey key)
UnuseKeyboardKey(KeyboardKey)
Remove the used mark for given keyboard-key
Declaration
public static void UnuseKeyboardKey(KeyboardKey key)
UnuseMouseKey(int)
Remove the used mark for given mouse button
Declaration
public static void UnuseMouseKey(int key)
UseAllHoldingKeys(bool)
Mark all current holding game-keys ans keyboard-keys as used so they will not be "down" or "holding" at current frame
Declaration
public static void UseAllHoldingKeys(bool ignoreMouse = false)
UseAllMouseKey()
Mark all current holding mouse buttons as used so they will not be "down" or "holding" at current frame
Declaration
public static void UseAllMouseKey()
UseGameKey(Gamekey)
Mark given game-key as used so it will not be "down" or "holding" at current frame
Declaration
public static void UseGameKey(Gamekey key)
UseKeyboardKey(KeyboardKey)
Mark given keyboard-key as used so it will not be "down" or "holding" at current frame
Declaration
public static void UseKeyboardKey(KeyboardKey key)
UseMouseKey(int)
Mark given mouse button as used so it will not be "down" or "holding" at current frame
Declaration
public static void UseMouseKey(int index)