GP2X Button/joystick Mappings Gp2x <==> Sdl ?


evening2005

Member
Joined
Sep 23, 2005
Messages
137
Hi all,

First of all, a big "thanks" to the community; with your help I've managed to build simple SDL programs on both Windows and Linux (not tried OSX yet, but that should work too) and get them working on the GP2X. I'm now at the point when I want to port my little pong demonstration, and it works apart from the fact that I don't know what events my event handler should be looking for. To be honest, I've never messed with SDL "under the hood" so I'm not at all sure how simple what I want is. At the moment, my pong game just reads the keyboard:


Code:
/* handle the keyboard */
case SDL_KEYDOWN:
    switch (event.key.keysym.sym) {
        case SDLK_ESCAPE:
        case SDLK_q:
            gameover = 1;
             break;
        case SDLK_UP:
            playerBatMoveY = -playerBatSPEED;
            break;
        case SDLK_DOWN:
            playerBatMoveY = +playerBatSPEED;
            break;
    }
    break;
case SDL_KEYUP:
    /*
            etc etc etc
    */

I'm not at all sure what I should be looking for instead of SDLK_UP and SDLK_DOWN in the excerpt above. Can anyone offer any pointers? Do I need to work at a lower level, or are the buttons and joystick directions mapped to other (existing) SDLK_ constants?

Thanks for any help you can offer!
 
Are you sure it isn't SDL_KDOWN and SDL_KUP? It is on GP32 SDL.
It might very well be, but those two constants aren't mapped in the libraries I have. Do you know where I might find the source of GP32 SDL? I might be able to have a guess at what I'm supposed to be doing if I had a copy of that...
 
Last edited by a moderator:
Yeah I've had a couple of comments to that effect, but I just pasted the code from my header file in there. Can you guys check if my releases (rockdodger, kobo, sopwith) are working properly for you ?
 
Back
Top