comparison src/video/win32/SDL_win32events.c @ 2309:21591ae7355d

Implemented text input event for Win32
author Sam Lantinga <slouken@libsdl.org>
date Sat, 09 Feb 2008 06:47:46 +0000
parents 514f7c1651fc
children 2f31ce8f1149
comparison
equal deleted inserted replaced
2308:514f7c1651fc 2309:21591ae7355d
395 data->videodata->key_layout[wParam]); 395 data->videodata->key_layout[wParam]);
396 } 396 }
397 } 397 }
398 return (0); 398 return (0);
399 399
400 case WM_CHAR:
401 {
402 char text[4];
403
404 /* Convert to UTF-8 and send it on... */
405 if (wParam <= 0x7F) {
406 text[0] = (char) wParam;
407 text[1] = '\0';
408 } else if (wParam <= 0x7FF) {
409 text[0] = 0xC0 | (char) ((wParam >> 6) & 0x1F);
410 text[1] = 0x80 | (char) (wParam & 0x3F);
411 text[2] = '\0';
412 } else {
413 text[0] = 0xE0 | (char) ((wParam >> 12) & 0x0F);
414 text[1] = 0x80 | (char) ((wParam >> 6) & 0x3F);
415 text[2] = 0x80 | (char) (wParam & 0x3F);
416 text[3] = '\0';
417 }
418 SDL_SendKeyboardText(data->videodata->keyboard, text);
419 }
420 return (0);
421
400 case WM_GETMINMAXINFO: 422 case WM_GETMINMAXINFO:
401 { 423 {
402 MINMAXINFO *info; 424 MINMAXINFO *info;
403 RECT size; 425 RECT size;
404 int x, y; 426 int x, y;