C# Класс GarrysModLuaShared.input

The input library allows you to gather information about the clients input devices (mouse & keyboard), such as the cursor position and whether a key is pressed or not.
Показать файл Открыть проект

Открытые методы

Метод Описание
CheckKeyTrapping ( LuaState luaState ) : KEY

Returns the last key captured by key trapping.

GetCursorPos ( LuaState luaState ) : double>.Tuple

Returns the cursor's position on the screen.

GetCursorPos ( LuaState luaState, double &mouseX, double &mouseY ) : void

Returns the cursor's position on the screen.

GetKeyName ( LuaState luaState, BUTTON button ) : string

Gets the name of the button index.

IsButtonDown ( LuaState luaState, BUTTON button ) : bool

Gets whether the specified button code is down. Unlike input.IsKeyDown this can also detect joystick presses from JOYSTICK enum.

IsControlDown ( LuaState luaState ) : bool

Returns whether a control key is being pressed.

IsKeyDown ( LuaState luaState, KEY key ) : bool

Gets whether a key is down.

IsKeyTrapping ( LuaState luaState ) : bool

Returns whether key trapping is activate and the next key press will be captured.

IsMouseDown ( LuaState luaState, MOUSE mouseKey ) : bool

Gets whether a mouse button is down.

IsShiftDown ( LuaState luaState ) : bool

Gets whether a shift key is being pressed.

LookupBinding ( LuaState luaState, string binding, bool exact = false ) : string

Gets the match uppercase key for the specified binding.

LookupKeyBinding ( LuaState luaState, KEY key ) : string

Returns the bind string that the given key is bound to.

SetCursorPos ( LuaState luaState, double mouseX, double mouseY ) : void

Sets the cursor's position on the screen, relative to the topleft corner of the window.

StartKeyTrapping ( LuaState luaState ) : void

Starts key trap.

WasKeyPressed ( LuaState luaState, KEY key ) : bool

Returns whether a key was initially pressed in the same frame this function was called. This function only works in Move hooks, and will detect key presses even in main menu or when a typing in a text field.

WasKeyReleased ( LuaState luaState, KEY key ) : bool

Returns whether a key was released in the same frame this function was called. This function only works in Move hooks, and will detect key releases even in main menu or when a typing in a text field.

WasKeyTyped ( LuaState luaState, KEY key ) : bool

Returns whether the key is being held down or not. This function only works in Move hooks, and will detect key events even in main menu or when a typing in a text field.

WasMouseDoublePressed ( LuaState luaState, MOUSE button ) : bool

Returns whether a mouse key was double pressed in the same frame this function was called. If this function returns true, WasMousePressed will return false. This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.

WasMousePressed ( LuaState luaState, MOUSE button ) : bool

Returns whether a mouse key was initially pressed in the same frame this function was called. If WasMouseDoublePressed returns true, this function will return false. This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.

Описание методов

CheckKeyTrapping() публичный статический Метод

Returns the last key captured by key trapping.
public static CheckKeyTrapping ( LuaState luaState ) : KEY
luaState LuaState Pointer to lua_State struct.
Результат KEY

GetCursorPos() публичный статический Метод

Returns the cursor's position on the screen.
public static GetCursorPos ( LuaState luaState ) : double>.Tuple
luaState LuaState Pointer to lua_State struct.
Результат double>.Tuple

GetCursorPos() публичный статический Метод

Returns the cursor's position on the screen.
public static GetCursorPos ( LuaState luaState, double &mouseX, double &mouseY ) : void
luaState LuaState Pointer to lua_State struct.
mouseX double Mouse X coordinate.
mouseY double Mouse Y coordinate.
Результат void

GetKeyName() публичный статический Метод

Gets the name of the button index.
public static GetKeyName ( LuaState luaState, BUTTON button ) : string
luaState LuaState Pointer to lua_State struct.
button BUTTON The button.
Результат string

IsButtonDown() публичный статический Метод

Gets whether the specified button code is down. Unlike input.IsKeyDown this can also detect joystick presses from JOYSTICK enum.
public static IsButtonDown ( LuaState luaState, BUTTON button ) : bool
luaState LuaState Pointer to lua_State struct.
button BUTTON The button, valid values are in the range of enum.
Результат bool

IsControlDown() публичный статический Метод

Returns whether a control key is being pressed.
public static IsControlDown ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
Результат bool

IsKeyDown() публичный статический Метод

Gets whether a key is down.
public static IsKeyDown ( LuaState luaState, KEY key ) : bool
luaState LuaState Pointer to lua_State struct.
key KEY The key.
Результат bool

IsKeyTrapping() публичный статический Метод

Returns whether key trapping is activate and the next key press will be captured.
public static IsKeyTrapping ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
Результат bool

IsMouseDown() публичный статический Метод

Gets whether a mouse button is down.
public static IsMouseDown ( LuaState luaState, MOUSE mouseKey ) : bool
luaState LuaState Pointer to lua_State struct.
mouseKey MOUSE The mouse key.
Результат bool

IsShiftDown() публичный статический Метод

Gets whether a shift key is being pressed.
public static IsShiftDown ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
Результат bool

LookupBinding() публичный статический Метод

Gets the match uppercase key for the specified binding.
public static LookupBinding ( LuaState luaState, string binding, bool exact = false ) : string
luaState LuaState Pointer to lua_State struct.
binding string The binding name.
exact bool True if the binding should match exactly.
Результат string

LookupKeyBinding() публичный статический Метод

Returns the bind string that the given key is bound to.
public static LookupKeyBinding ( LuaState luaState, KEY key ) : string
luaState LuaState Pointer to lua_State struct.
key KEY The key.
Результат string

SetCursorPos() публичный статический Метод

Sets the cursor's position on the screen, relative to the topleft corner of the window.
public static SetCursorPos ( LuaState luaState, double mouseX, double mouseY ) : void
luaState LuaState Pointer to lua_State struct.
mouseX double X coordinate for mouse position.
mouseY double Y coordinate for mouse position.
Результат void

StartKeyTrapping() публичный статический Метод

Starts key trap.
public static StartKeyTrapping ( LuaState luaState ) : void
luaState LuaState Pointer to lua_State struct.
Результат void

WasKeyPressed() публичный статический Метод

Returns whether a key was initially pressed in the same frame this function was called. This function only works in Move hooks, and will detect key presses even in main menu or when a typing in a text field.
public static WasKeyPressed ( LuaState luaState, KEY key ) : bool
luaState LuaState Pointer to lua_State struct.
key KEY The key.
Результат bool

WasKeyReleased() публичный статический Метод

Returns whether a key was released in the same frame this function was called. This function only works in Move hooks, and will detect key releases even in main menu or when a typing in a text field.
public static WasKeyReleased ( LuaState luaState, KEY key ) : bool
luaState LuaState Pointer to lua_State struct.
key KEY The key.
Результат bool

WasKeyTyped() публичный статический Метод

Returns whether the key is being held down or not. This function only works in Move hooks, and will detect key events even in main menu or when a typing in a text field.
public static WasKeyTyped ( LuaState luaState, KEY key ) : bool
luaState LuaState Pointer to lua_State struct.
key KEY The key.
Результат bool

WasMouseDoublePressed() публичный статический Метод

Returns whether a mouse key was double pressed in the same frame this function was called. If this function returns true, WasMousePressed will return false. This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.
public static WasMouseDoublePressed ( LuaState luaState, MOUSE button ) : bool
luaState LuaState Pointer to lua_State struct.
button MOUSE The mouse button to test.
Результат bool

WasMousePressed() публичный статический Метод

Returns whether a mouse key was initially pressed in the same frame this function was called. If WasMouseDoublePressed returns true, this function will return false. This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.
public static WasMousePressed ( LuaState luaState, MOUSE button ) : bool
luaState LuaState Pointer to lua_State struct.
button MOUSE The mouse button to test.
Результат bool