Commits

Anonymous committed 7888bba Draft

Added scankey support too.

Comments (0)

Files changed (1)

 	SDL_Event event;
 	int KeyCode = 0;
 	char keyCodeStr[10];
+	int scancode = 0;
 
 	SDL_Init(SDL_INIT_VIDEO); // Initialize SDL
 	screen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE); // Set screen video mode 
 				kbai();
 			} else if(event.type == SDL_KEYDOWN) {
 				KeyCode = event.key.keysym.sym;
-				sprintf(keyCodeStr, "%d", KeyCode);
+				scancode = ((SDL_KeyboardEvent*)(&event))->keysym.scancode;
+				sprintf(keyCodeStr, "%d %d", KeyCode, scancode);
 				
 				if(KeyCode == SDLK_ESCAPE) {
+					printf("escape hit, quitting here are the codes. %s\n", keyCodeStr);
 					kbai();
 				} else {
 					TTF_SizeText(font, keyCodeStr, &width, &height);