Skip to content

Commit

Permalink
Revert keyboard state optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Dec 27, 2024
1 parent 33fd26f commit bb6a1f3
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions include/imgui/imgui_user.inl
Original file line number Diff line number Diff line change
Expand Up @@ -3495,28 +3495,10 @@ SK_ImGui_User_NewFrame (void)

if (bActive && new_input)
{
static BYTE last_keystate [255];
BYTE keystate [255];

// GetKeyboardState (...) is much more efficient than
// unnecessarily calling GetAsyncKeyState over and over
BOOL new_input_keyboard =
!SK_GetKeyboardState (keystate);

if (! new_input_keyboard)
for (UINT i = 7 ; i < 255 ; ++i)
{
new_input_keyboard =
memcmp (keystate, last_keystate, 255);
memcpy ( keystate, last_keystate, 255);
}

if (new_input_keyboard)
{
for (UINT i = 7 ; i < 255 ; ++i)
{
io.KeysDown [i] =
((SK_GetAsyncKeyState (i) & 0x8000) != 0x0);
}
io.KeysDown [i] =
((SK_GetAsyncKeyState (i) & 0x8000) != 0x0);
}
}

Expand Down

0 comments on commit bb6a1f3

Please sign in to comment.