Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WinRT: made use of Win32 key codes if and when a documented WinRT key…
Browse files Browse the repository at this point in the history
… code can't be found
  • Loading branch information
DavidLudwig committed Jan 23, 2013
1 parent dc0df53 commit 69c1e39
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/video/windowsrt/SDL_WinRTApp.cpp
Expand Up @@ -8,6 +8,7 @@ extern "C" {
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_windowevents_c.h"
#include "../../events/scancodes_windows.h"
#include "SDL_events.h"
#include "SDL_log.h"
}
Expand Down Expand Up @@ -462,10 +463,20 @@ static SDL_Scancode WinRT_Keycodes[] = {
static SDL_Scancode
TranslateKeycode(int keycode)
{
/* Try to get a documented, WinRT, 'VirtualKey' first (as documented at
http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.virtualkey.aspx ).
If that fails, try to get a Win32 virtual key.
*/
// TODO, WinRT: try filling out the WinRT keycode table as much as possible, using the Win32 table for interpretation hints
SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
if (keycode < SDL_arraysize(WinRT_Keycodes)) {
scancode = WinRT_Keycodes[keycode];
}
if (scancode == SDL_SCANCODE_UNKNOWN) {
if (keycode < SDL_arraysize(windows_scancode_table)) {
scancode = windows_scancode_table[keycode];
}
}
if (scancode == SDL_SCANCODE_UNKNOWN) {
SDL_Log("WinRT TranslateKeycode, unknown keycode=%d\n", (int)keycode);
}
Expand Down

0 comments on commit 69c1e39

Please sign in to comment.