Checking if the Shift or Alt is pressed.
I'm trying to check if a modifier has been press on the keyboard by itself
Here is my code..
If I did the following:
if (al_key_down(&kbdState, ALLEGRO_KEY_A)) keyshift = TRUE;
This works when I press down "A" - so do I need to do something different with modifiers?
Figured it out
if (al_key_down(&kbdState, ALLEGRO_KEY_LSHIFT) || (al_key_down(&kbdState, ALLEGRO_KEY_RSHIFT))) keyshift = TRUE;
else keyshift = FALSE;
if (al_key_down(&kbdState, ALLEGRO_KEY_ALT) || (al_key_down(&kbdState, ALLEGRO_KEY_ALTGR))) keyalt = TRUE;
else keyalt = FALSE;
Thread #617163. Printed from Allegro.cc
If that's your actual code, you can simplify to this:
The Allegro 5 way would probably be to update the booleans based on events instead, though.