| Summary: | RFC: prototype implementation of physical key codes | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Christian Walther <cwalther> |
| Component: | events | Assignee: | Christian Walther <cwalther> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | API change | ||
| Priority: | P2 | ||
| Version: | 2.0.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
Patch against /branches/SDL-1.2 rev. 2741
Demonstrates use of physical keycodes in a game. |
||
|
Description
Christian Walther
2006-09-03 06:54:25 UTC
Created attachment 160 [details]
Patch against /branches/SDL-1.2 rev. 2741
Created attachment 161 [details]
Demonstrates use of physical keycodes in a game.
Discussion thread on the mailing list here: <http://thread.gmane.org/gmane.comp.lib.sdl/29599> I have mixed feelings on this. I'll definitely review it for inclusion in SDL 1.3 though. A Win32 implementation is crucial, BTW. (In reply to comment #4) > I have mixed feelings on this. I'll definitely review it for inclusion in SDL > 1.3 though. Thanks. I don't mind if you end up rejecting it (though I'd be interested in the reasons) - I mainly wrote this for two reasons: to prove to myself that it can be done, and to have something to show to the people who seemed to misunderstand my explanations about how I imagine this to work and why I think it's useful. > A Win32 implementation is crucial, BTW. I absolutely agree. It's just that Windows is not my home platform and so I postponed the work of finding out how to do this there until I know more about its chances of making it into SDL. I chatted with Christian for a while today, and I agree with the need to provide positional key information. This is what we came up with for SDL 1.3: > SDLK_* become the physical keys, starting at > (1<<21) > We create a macro SDLK_INDEX(X) used to map the sym into an array > We have two functions SDL_GetLayoutKey(SDLKey) and SDL_GetKeyName() > SDL_GetLayoutKey maps to UCS4 for printable characters, and SDLK* for non-printable characters and does so based on the OS's current keyboard layout > SDL_GetKeyName() handles both SDLK_* and UCS4, converting UCS4 to UTF-8 and converting SDLK_* into our names, which are UTF-8 for printable characters. > WASD folks use SDLK_*, and 'I' folks use SDL_GetLayoutKey(SDLK_*) This is subject to change, but he's going to take a crack at prototyping this in SDL 1.3. Physical keycodes are in SDL 1.3, see include/SDL_scancode.h for details. |