Mercurial > sdl-ios-xcode
view src/video/quartz/SDL_QuartzWindow.m @ 172:37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
From: Max Horn <max@quendi.de>
Subject: SDL/OSX: Joystick; Better key handling
I just finished implementing improved keyhandling for OS X (in fact
the code should be easily ported to the "normal" MacOS part of SDL, I
just had no chance yet). Works like this:
First init the mapping table statically like before. Them, it queries
the OS for the "official" key table, then iterates over all 127
scancode and gets the associates ascii code. It ignores everythng
below 32 (has to, as it would lead to many problems if we did not...
e.g. both ESC and NUM LOCk produce an ascii code 27 on my keyboard),
and all stuff above 127 is mapped to SDLK_WORLD_* simply in the order
it is encountered.
In addition, caps lock is now working, too.
The code work flawless for me, but since I only have one keyboard, I
may have not encountered some serious problem... but I am pretty
confident that it is better than the old code in most cases.
The joystick driver works fine for me, too. I think it can be added
to CVS already. It would simply be helpful if more people would test
it. Hm, I wonder if Maelstrom or GLTron has Joystick support? That
would be a wonderful test application :)
I also took the liberty of modifying some text files like BUGS,
README.CVS, README.MacOSX (which now contains the OS X docs I long
promised)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 11 Sep 2001 19:00:18 +0000 |
parents | bd6b0a910a65 |
children | d1447a846d80 |
line wrap: on
line source
/* Subclass of NSWindow to allow customization if we need it */ @interface SDL_QuartzWindow : NSWindow {} - (void)miniaturize:(id)sender; - (void)deminiaturize:(id)sender; - (void)display; @end @implementation SDL_QuartzWindow /* These methods should be rewritten to fix the miniaturize bug */ - (void)miniaturize:(id)sender { [ super miniaturize:sender ]; } - (void)deminiaturize:(id)sender { [ super deminiaturize:sender ]; } - (void)display { /* Do nothing to keep pinstripe pattern from drawing */ } @end /* Delegate for our NSWindow to send SDLQuit() on close */ @interface SDL_QuartzWindowDelegate : NSObject {} - (BOOL)windowShouldClose:(id)sender; @end @implementation SDL_QuartzWindowDelegate - (BOOL)windowShouldClose:(id)sender { SDL_PrivateQuit(); return NO; } @end