flibitijibibo/SDL2-CS — pull request #12 by sulix (2013-04-05 15:10:40+00:00)
Title: SDL_Keycode (Episode V: The scancode strikes back)

This is a bit nastier than SDL_Scancode was. In the SDL2 C headers, SDL_Keycode is simply a typedef'd int32, but the names are not defines, they're in an anonymous enum.

I've made this an enum here, as C# doesn't do typedef (sigh).

Furthermore, the values for Keycodes are half unicode values and half scancode values ORed with (1 >> 30). This is normally done with preprocessor macros, but C#.

The code here is therefore a bit ugly, but it _should_ work the same way as SDL_Scancode for the user, and is about as faithful to the original C as I could get without causing some horrific inconsistencies.

-- David