Simultaneous button presses
Posted: Wed Jul 18, 2012 12:35 am
This might be a trivial question but I can't seem to find the answer. I would like to move stuff diagonally, so I want to check for KEY_UP and KEY_RIGHT for example. What I do at the moment is the following:
while(1) loop, lastKey is just a global int
Then I switch
So I tried
but that didn't seem to work as I'm guessing keysDown() only reports the last pressed button. What is the correct way to handle this?
while(1) loop, lastKey is just a global int
Code: Select all
scanKeys();
if(keysDown())
lastKey = keysDown();
Code: Select all
switch(lastKey)
{
case (KEY_RIGHT):
//Code here
Code: Select all
case (KEY_UP | KEY_RIGHT):