Helper methods – InputReading helpers - TiberiumFusion/TTPlugins GitHub Wiki
← Back to the Helper methods overview article.
These helpers are located in the nested HHelpers.InputReading
class and get information about the local player's input, such what Keys
are currently held.
All helper methods are static
.
bool
IsKeyDown
(Keys key)
Method Checks if the specified Keys
key
is currently held down or not. Returns true
if it is down, or false
if it is up.
Example usage:
if (HHelpers.InputReading.IsKeyDown(Keys.A))
{
Debug.WriteLine("The local player is holding down the A key");
}
bool
IsKeyPressed
(Keys key)
Method Checks if the specified Keys
key
was held down during the last update and is released in the current update. In other words, this will only return true
for the single update cycle after the local player has released the key. Returns true
or false
.
Example usage:
if (HHelpers.InputReading.IsKeyPressed(Keys.A))
{
Debug.WriteLine("The local player just pressed the A key");
}
bool
IsKeyComboDown
(Keys baseKey, Keys modifierKey)
Method Return true
if the Keys
baseKey
is currently held AND that the modifierKey
is currently held down. Returns false
otherwise. If Keys
modifierKey
equals Keys.None
, that part of the check is skipped, and this method becomes functionally equivalent to IsKeyDown()
.
Example usage:
if (HHelpers.InputReading.IsKeyComboDown(Keys.A, Keys.LeftControl))
{
Debug.WriteLine("The local player is holding down Ctrl+A");
}
bool
IsKeyComboPressed
(Keys baseKey, Keys modifierKey)
Method Return true
if the Keys
baseKey
was just pressed (see IsKeyPressed()
) AND that the Keys
modifierKey
is currently held down. Returns false
otherwise. If modifierKey
equals Keys.None
, that part of the check is skipped, and this method becomes functionally equivalent to IsKeyPressed()
.
TIP: This is a good method for detecting if the user has just pressed a hotkey combo, such as Ctrl + A.
Example usage:
if (HHelpers.InputReading.IsKeyComboPressed(Keys.A, Keys.LeftControl))
{
Debug.WriteLine("The local player just entered the Ctrl+A command");
}
← Back to the Helper methods overview article.