bug report gp2x GetKeyState doesn't work

Non-platform specific questions.

bug report gp2x GetKeyState doesn't work

Postby pixelpoop » Sun Aug 12, 2007 8:47 pm

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
}
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby makslane » Sun Aug 12, 2007 9:12 pm

Try use the GP2X keys, like:

KEY_GP2X_BUTTON_UP
KEY_GP2X_BUTTON_DOWN
KEY_GP2X_BUTTON_LEFT
KEY_GP2X_BUTTON_RIGHT
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby pixelpoop » Mon Aug 13, 2007 1:08 am

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)
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest