Created
October 27, 2020 18:25
-
-
Save BigETI/300592aa21861e86d6dcf9ebc77e5467 to your computer and use it in GitHub Desktop.
Helper function to check key states in PAWN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool:AreKeysDown(keys, oldKeys, newKeys) | |
{ | |
return ((oldKeys & keys) != keys) && ((newKeys & keys) == keys); | |
} | |
bool:AreKeysUp(keys, oldKeys, newKeys) | |
{ | |
return ((oldKeys & keys) == keys) && ((newKeys & keys) != keys) | |
} | |
bool:AreKeysPressed(keys, newKeys) | |
{ | |
return (newKeys & keys) == keys; | |
} | |
bool:IsAnyKeyFromKeysDown(keys, oldKeys, newKeys) | |
{ | |
return !(oldKeys & keys) && (newKeys & keys); | |
} | |
bool:IsAnyKeyFromKeysUp(keys, oldKeys, newKeys) | |
{ | |
return (oldKeys & keys) && !(newKeys & keys); | |
} | |
bool:IsAnyKeyFromKeysPressed(keys, newKeys) | |
{ | |
return !!(newKeys & keys); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment