Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Other - [AGK] A true 'getLastKeyPress'

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Apr 2013 09:54
Not sure if this is the most efficient code in the world, but it gets the job done. If you press two or more keys and then release one, getRawLastKey() will still only return the last one 'pressed', even if its been released and other keys are still being pressed down. This aims to correct that, and if no keys are currently pressed will return 0.

If you press A then B, the function will return the key code for B. If you release B while still holding A, then it will return the code for A instead rather keep returning B like getRawLastKey() would.

This will remember the last 4 keys pressed, but can easily be changed to support more if needed.



"You're all wrong. You're all idiots." ~Fluffy Rabbit

Login to post a reply

Server time is: 2024-04-25 16:12:54
Your offset time is: 2024-04-25 16:12:54