Page 1 of 1

bug report gp2x GetKeyState doesn't work

PostPosted: Sun Aug 12, 2007 8:47 pm
by pixelpoop
I don't think the GetKeyState has ever worked on the gp2x.
I used the code found in the Script Reference under the heading "GetKeyState:" on an actor's draw script. When playing under the "Game Mode" button the actor works as expected. When exported and played on the gp2x the actor won't move.

The code follows:

char *key = GetKeyState(); //Get entire keyboard state

if(key[KEY_RIGHT] == 1) //Test if right key is pressed
{
x = x + 5; //Move actor to right
}

if(key[KEY_LEFT] == 1) //Test if left key is pressed
{
x = x - 5; //Move actor to left
}

PostPosted: Sun Aug 12, 2007 9:12 pm
by makslane
Try use the GP2X keys, like:

KEY_GP2X_BUTTON_UP
KEY_GP2X_BUTTON_DOWN
KEY_GP2X_BUTTON_LEFT
KEY_GP2X_BUTTON_RIGHT

PostPosted: Mon Aug 13, 2007 1:08 am
by pixelpoop
great thanks,
but does this mean I have to code every direction with an "or"?
like this:
if(key[KEY_GP2X_BUTTON_RIGHT]|| key[KEY_RIGHT]== 1)