Skip to content

Commit 3d80159

Browse files
committed
Added tool for checking scancodes
1 parent 92e0e0c commit 3d80159

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/src/version_number.h
66
/src/version.h
77
*.dll
8+
*.exe

scancode-tool/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CC = gcc -s -Ic:/MinGW/include/SDL2
2+
EXE = scancode.exe
3+
4+
$(EXE): scancode.c
5+
$(CC) -o $@ $^ -lmingw32 -lSDL2main -lSDL2

scancode-tool/scancode.c

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "SDL.h"
2+
#include <stdio.h>
3+
4+
int main(int argc, char **argv)
5+
{
6+
SDL_Init(SDL_INIT_EVERYTHING);
7+
SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 100, 100, 0);
8+
9+
printf("Make sure the empty window is focused and hit any key to see info for that key!\n\n");
10+
11+
while (1)
12+
{
13+
SDL_Event e;
14+
15+
if (SDL_PollEvent(&e))
16+
{
17+
if (e.type == SDL_QUIT)
18+
break;
19+
20+
if (e.type == SDL_KEYDOWN)
21+
{
22+
printf("scancode = %x\tsym = %x\tmod = %x\n", e.key.keysym.scancode, e.key.keysym.sym, e.key.keysym.mod);
23+
}
24+
}
25+
else
26+
SDL_Delay(10);
27+
}
28+
29+
SDL_Quit();
30+
31+
return 0;
32+
}

0 commit comments

Comments
 (0)