[SDL] SDL 1.3 Compatibility
Sam Lantinga
slouken at devolution.com
Sat Jan 3 10:18:12 PST 2009
> SDLK_* macros have had some changes, notably both SDLK_FIRST and
> SDLK_LAST have been removed (which I both use) and it seems like the
> scancodes don't map to ASCII anymore. Is this definitive? Is there a
> little howto or something on moving from SDL 1.2 keyboard system to SDL
> 1.3 keyboard system? This has got me a bit confused.
The SDL 1.3 keyboard system has two sets of key codes. One set,
SDL_SCANCODE_*, is designed to represent the physical keys of the keyboard,
and is based on the USB HID standard. The other set, SDLK_*, is designed
to represent the unmodified keys in the current keyboard layout, and maps
to Unicode values printed on the keys. The non-printable keys have been
moved out of the Unicode code point space so as to avoid conflicts.
Which set you use is dependent upon the needs of your program.
What you probably want is the new SDL_GetKeyboardState() function,
which is indexed by scancodes.
It's important to note that the scancodes are not affected by keyboard
layout, so don't assume that SDL_SCANCODE_A means the letter 'a' on anything
but a US DVORAK keyboard layout.
> SDL_PixelFormat seems to be completely different. Will some
> compatibility be added for 1.2's SDL_PixelFormat? or will there be a
> rough "conversion" guide made to upgrade code to 1.3? I prefer the
> former, because I've never been a big fan of preprocessor #ifs in the code.
The SDL_PixelFormat is now used just to describe the pixel format, and has
all the same fields it did for that (palette, BitsPerPixel, masks, etc.).
The blit modifiers (colorkey, per-surface alpha) are now stored in the
surfaces and can be accessed with the functions in SDL_surface.h
> Other then that it looks pretty solid, haven't really gotten around to
> test more functionality though. It seems like I'll have to compile a
> new SDL_Mixer for SDL 1.3 since that looks broken, but SDL_Image is
> working ok.
Yeah, try grabbing SDL_mixer from subversion. I think there was one minor
change that was needed for SDL 1.3.
Thanks for checking it out!
See ya,
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
More information about the SDL
mailing list