comparison src/video/win32/SDL_win32keyboard.c @ 2317:f537a293b3da

Windows also remaps the numeric keypad... grrr
author Sam Lantinga <slouken@libsdl.org>
date Mon, 11 Feb 2008 21:06:32 +0000
parents 54e21acfec5a
children 3202e4826c57
comparison
equal deleted inserted replaced
2316:5e1f06dc5136 2317:f537a293b3da
39 /* Alphabetic scancodes for PC keyboards */ 39 /* Alphabetic scancodes for PC keyboards */
40 BYTE alpha_scancodes[26] = { 40 BYTE alpha_scancodes[26] = {
41 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 41 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24,
42 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44 42 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44
43 }; 43 };
44 BYTE keypad_scancodes[10] = {
45 82, 79, 80, 81, 75, 76, 77, 71, 72, 73
46 };
44 47
45 void 48 void
46 WIN_InitKeyboard(_THIS) 49 WIN_InitKeyboard(_THIS)
47 { 50 {
48 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 51 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
53 if (MapVirtualKey('T', MAPVK_VK_TO_VSC) != alpha_scancodes['T'-'A']) { 56 if (MapVirtualKey('T', MAPVK_VK_TO_VSC) != alpha_scancodes['T'-'A']) {
54 printf("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n"); 57 printf("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
55 for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) { 58 for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) {
56 alpha_scancodes[i] = MapVirtualKey('A'+i, MAPVK_VK_TO_VSC); 59 alpha_scancodes[i] = MapVirtualKey('A'+i, MAPVK_VK_TO_VSC);
57 printf("%d = %d\n", i, alpha_scancodes[i]); 60 printf("%d = %d\n", i, alpha_scancodes[i]);
61 }
62 }
63 if (MapVirtualKey(VK_NUMPAD0, MAPVK_VK_TO_VSC) != keypad_scancodes[0]) {
64 printf("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
65 for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
66 keypad_scancodes[i] = MapVirtualKey(VK_NUMPAD0+i, MAPVK_VK_TO_VSC);
67 printf("%d = %d\n", i, keypad_scancodes[i]);
58 } 68 }
59 } 69 }
60 70
61 data->key_layout = win32_scancode_table; 71 data->key_layout = win32_scancode_table;
62 72