SDL keys not working on macbook pro

Hi,

I have just recompiled a Linux game and got it running on Mak OS X :slight_smile: The only problem is the cursor keys don’t work (well actually the up works). I did a google and see someone else had a problem with an emulator written using the SDL librar,. so the problem seems pretty fundamental. From a quick look a thecode I can see it using constants SDL_DOWN, SDL_LEFT etc. I havn’t looked where they are defined but I would guess in one of the SDL header files. If this is so then these constants would appear to be defined wrong for the mac port of SDL (hard to believe). Anyway I thought I would post here if there is a proper known solution, as I would rather use that, than hack it.

Regards,

Ben.

Hi Benjamin,On Mon, Jun 1, 2009 at 1:20 PM, Benjamin Nice <benjamin_nice at mac.com> wrote:

I have just recompiled a Linux game and got it running on Mak OS X :slight_smile: The only problem is the cursor keys don’t work (well actually the up works). I did a google and see someone else had a problem with an emulator written using the SDL librar,. so the problem seems pretty fundamental. From a quick look a thecode I can see it using constants SDL_DOWN, SDL_LEFT etc. I havn’t looked where they are defined but I would guess in one of the SDL header files. If this is so then these constants would appear to be defined wrong for the mac port of SDL (hard to believe). Anyway I thought I would post here if there is a proper known solution, as I would rather use that, than hack it.

You may want to print out the SDL_KEYDOWN event you received within
the game with the following statement:

case SDL_KEYDOWN:
    fprintf(stderr,
            "Keyboard %d: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
            event.key.which, event.key.keysym.scancode,
            SDL_GetScancodeName(event.key.keysym.scancode),
            event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
  • Jiang

Hi All,

Solved it was coding problem in the game. It was trying to do something funky if it was a uni-code character was an asc ii char but was wrong so have fixed. The game now works perfectly all be at 2400fps! (think I am going to modify the code to throttle that not good on the batteries on a notebook :wink:

Ben.On Monday, June 01, 2009, at 05:32PM, “Jjgod Jiang” wrote:

Hi Benjamin,

On Mon, Jun 1, 2009 at 1:20 PM, Benjamin Nice <@Benjamin_Nice> wrote:

I have just recompiled a Linux game and got it running on Mak OS X :slight_smile: The only problem is the cursor keys don’t work (well actually the up works). I did a google and see someone else had a problem with an emulator written using the SDL librar,. so the problem seems pretty fundamental. From a quick look a thecode I can see it using constants SDL_DOWN, SDL_LEFT etc. I havn’t looked where they are defined but I would guess in one of the SDL header files. If this is so then these constants would appear to be defined wrong for the mac port of SDL (hard to believe). Anyway I thought I would post here if there is a proper known solution, as I would rather use that, than hack it.

You may want to print out the SDL_KEYDOWN event you received within
the game with the following statement:

case SDL_KEYDOWN:
fprintf(stderr,
“Keyboard %d: scancode 0x%08X = %s, keycode 0x%08X = %s\n”,
event.key.which, event.key.keysym.scancode,
SDL_GetScancodeName(event.key.keysym.scancode),
event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));

  • Jiang

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org