Interface IInputAPI
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
This interface manages the inputs of the player and is used mostly on the client side.
public interface IInputAPI
- Extension Methods
Properties
ClipboardText
Get set clipboard text
string ClipboardText { get; set; }
Property Value
HotKeys
Returns a list of all currently registered hotkeys.
OrderedDictionary<string, HotKey> HotKeys { get; }
Property Value
InWorldMouseButton
The current mouse button state outside of dialogs / clicked inside the game world
MouseButtonState InWorldMouseButton { get; }
Property Value
KeyboardKeyState
The current keyboard key states that were not handled by a dialog or other client systems (exception: hotkeys), use the GlKeys enum to get the array index of a key.
bool[] KeyboardKeyState { get; }
Property Value
- bool[]
KeyboardKeyStateRaw
The current keyboard key states, use the GlKeys enum to get the index of an array key.
bool[] KeyboardKeyStateRaw { get; }
Property Value
- bool[]
MouseButton
The current mouse button state
MouseButtonState MouseButton { get; }
Property Value
MouseGrabbed
True if the mouse cursor is currently grabbed and not visible. (Such as while controlling the character's view in first person.)
bool MouseGrabbed { get; }
Property Value
MousePitch
When controlling the camera, this is the camera pitch determined by the game engine
float MousePitch { get; set; }
Property Value
MouseWorldInteractAnyway
Gives the player the ability to still interact with the world even if a gui dialog is opened
bool MouseWorldInteractAnyway { get; set; }
Property Value
MouseX
The current x-position of the mouse, relative to the upper left corner of the game window
int MouseX { get; }
Property Value
MouseY
The current y-position of the mouse, relative to the upper left corner of the game window
int MouseY { get; }
Property Value
MouseYaw
When controlling the camera, this is the camera yaw determined by the game engine
float MouseYaw { get; set; }
Property Value
Methods
AddHotkeyListener(OnHotKeyDelegate)
void AddHotkeyListener(OnHotKeyDelegate handler)
Parameters
handler
OnHotKeyDelegate
GetHotKeyByCode(string)
Gets the hotkey by the given hotkey code.
HotKey GetHotKeyByCode(string toggleKeyCombinationCode)
Parameters
toggleKeyCombinationCode
stringthe key combination code.
Returns
- HotKey
The registered hotkey.
IsHotKeyPressed(string)
bool IsHotKeyPressed(string hotKeyCode)
Parameters
hotKeyCode
string
Returns
IsHotKeyPressed(HotKey)
bool IsHotKeyPressed(HotKey hotKey)
Parameters
hotKey
HotKey
Returns
RegisterHotKey(string, string, GlKeys, HotkeyType, bool, bool, bool)
Registers a hot key with given default key combination, the player will be able change these in the controls. Supplied hotkeyCode can than be used to register a hotkey handler.
void RegisterHotKey(string hotkeyCode, string name, GlKeys key, HotkeyType type = HotkeyType.CharacterControls, bool altPressed = false, bool ctrlPressed = false, bool shiftPressed = false)
Parameters
hotkeyCode
stringname
stringkey
GlKeystype
HotkeyTypealtPressed
boolctrlPressed
boolshiftPressed
bool
RegisterHotKeyFirst(string, string, GlKeys, HotkeyType, bool, bool, bool)
Same as RegisterHotKey except it inserts it at the start of the list
void RegisterHotKeyFirst(string hotkeyCode, string name, GlKeys key, HotkeyType type = HotkeyType.CharacterControls, bool altPressed = false, bool ctrlPressed = false, bool shiftPressed = false)
Parameters
hotkeyCode
stringname
stringkey
GlKeystype
HotkeyTypealtPressed
boolctrlPressed
boolshiftPressed
bool
SetHotKeyHandler(string, ActionConsumable<KeyCombination>)
Will call the handler if given hotkey has been pressed. Removes the previously assigned handler.
void SetHotKeyHandler(string hotkeyCode, ActionConsumable<KeyCombination> handler)
Parameters
hotkeyCode
stringhandler
ActionConsumable<KeyCombination>
TriggerOnMouseClickSlot(ItemSlot)
Handles the event when the mouse clicks on a given item slot.
void TriggerOnMouseClickSlot(ItemSlot itemSlot)
Parameters
itemSlot
ItemSlotThe slot of the item
Remarks
Part of a group of things that will be moved to an event bus at some point.
TriggerOnMouseEnterSlot(ItemSlot)
Handles the event when the mouse enters the bounding box of the given item slot.
void TriggerOnMouseEnterSlot(ItemSlot slot)
Parameters
slot
ItemSlotThe slot of the item.
Remarks
Part of a group of things that will be moved to an event bus at some point.
TriggerOnMouseLeaveSlot(ItemSlot)
Handles the event when the mouse leaves the bounding box of the given item slot.
void TriggerOnMouseLeaveSlot(ItemSlot itemSlot)
Parameters
itemSlot
ItemSlotThe slot of the item
Remarks
Part of a group of things that will be moved to an event bus at some point.
Events
InWorldAction
Triggered when the player attempts to trigger an action, such as walking forward or sprinting
event OnEntityAction InWorldAction