mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Add separate key buffer for shortcuts to fix misbehaving panning with keyboard
This commit is contained in:
parent
8b7a940aa4
commit
aeb5e2a0e4
3 changed files with 10 additions and 2 deletions
|
@ -850,8 +850,8 @@ int get_next_key()
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < 221; i++) {
|
||||
if (gKeysState[i]) {
|
||||
gKeysState[i] = 0;
|
||||
if (gKeysPressed[i]) {
|
||||
gKeysPressed[i] = 0;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef void(*update_palette_func)(char*, int, int);
|
|||
|
||||
openrct2_cursor gCursorState;
|
||||
unsigned char* gKeysState;
|
||||
unsigned char* gKeysPressed;
|
||||
unsigned int gLastKeyPressed;
|
||||
|
||||
static void osinterface_create_window();
|
||||
|
@ -49,6 +50,9 @@ void osinterface_init()
|
|||
{
|
||||
osinterface_create_window();
|
||||
|
||||
gKeysPressed = malloc(sizeof(unsigned char) * 256);
|
||||
memset(gKeysPressed, 0, sizeof(unsigned char) * 256);
|
||||
|
||||
// RCT2_CALLPROC(0x00404584); // dinput_init()
|
||||
}
|
||||
|
||||
|
@ -253,6 +257,7 @@ void osinterface_process_messages()
|
|||
break;
|
||||
case SDL_KEYDOWN:
|
||||
gLastKeyPressed = e.key.keysym.sym;
|
||||
gKeysPressed[e.key.keysym.scancode] = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -278,6 +283,8 @@ static void osinterface_close_window()
|
|||
|
||||
void osinterface_free()
|
||||
{
|
||||
free(gKeysPressed);
|
||||
|
||||
osinterface_close_window();
|
||||
SDL_Quit();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ typedef struct {
|
|||
|
||||
extern openrct2_cursor gCursorState;
|
||||
extern unsigned char* gKeysState;
|
||||
extern unsigned char* gKeysPressed;
|
||||
extern unsigned int gLastKeyPressed;
|
||||
|
||||
void osinterface_init();
|
||||
|
|
Loading…
Reference in a new issue