mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-01 07:11:18 +00:00
SDL2 support fix
This commit is contained in:
parent
e2c91c04da
commit
2d27c807d1
1 changed files with 15 additions and 2 deletions
|
@ -481,10 +481,9 @@ sysEvent_t Sys_GetEvent() {
|
||||||
// fall through
|
// fall through
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
key = mapkey(ev.key.keysym.sym);
|
key = mapkey(ev.key.keysym.sym);
|
||||||
|
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
if (!key) {
|
if (!key) {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
// check if its an unmapped console key
|
// check if its an unmapped console key
|
||||||
if (ev.key.keysym.unicode == (c = Sys_GetConsoleKey(false))) {
|
if (ev.key.keysym.unicode == (c = Sys_GetConsoleKey(false))) {
|
||||||
key = c;
|
key = c;
|
||||||
|
@ -496,6 +495,20 @@ sysEvent_t Sys_GetEvent() {
|
||||||
return res_none;
|
return res_none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if(!key) {
|
||||||
|
if (ev.key.keysym.scancode == SDL_SCANCODE_GRAVE) {
|
||||||
|
key = Sys_GetConsoleKey(true);
|
||||||
|
} else {
|
||||||
|
if (ev.type == SDL_KEYDOWN) {
|
||||||
|
common->Warning("unmapped SDL key %d", ev.key.keysym.sym);
|
||||||
|
return res_none;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
res.evType = SE_KEY;
|
res.evType = SE_KEY;
|
||||||
res.evValue = key;
|
res.evValue = key;
|
||||||
|
|
Loading…
Reference in a new issue