Commit 039e946 1 parent 0f05d99 commit 039e946 Copy full SHA for 039e946
File tree 1 file changed +33
-9
lines changed
1 file changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -701,18 +701,42 @@ WINBOOL TranslateMessage(const MSG *lpMsg)
701
701
SHORT GetAsyncKeyState (int vKey)
702
702
{
703
703
#ifndef USE_SDL1
704
- const Uint8 *state = SDL_GetKeyboardState (NULL );
705
- if (vKey == DVL_VK_SHIFT) {
706
- if (state[SDL_SCANCODE_LSHIFT] || state[SDL_SCANCODE_RSHIFT]) {
707
- return 0x8000 ;
708
- }
704
+ const Uint8 *state = SDL_GetKeyboardState (nullptr );
705
+ switch (vKey) {
706
+ case DVL_VK_SHIFT:
707
+ return state[SDL_SCANCODE_LSHIFT] || state[SDL_SCANCODE_RSHIFT] ? 0x8000 : 0 ;
708
+ case DVL_VK_MENU:
709
+ return state[SDL_SCANCODE_MENU] ? 0x8000 : 0 ;
710
+ case DVL_VK_LEFT:
711
+ return state[SDL_SCANCODE_LEFT] ? 0x8000 : 0 ;
712
+ case DVL_VK_UP:
713
+ return state[SDL_SCANCODE_UP] ? 0x8000 : 0 ;
714
+ case DVL_VK_RIGHT:
715
+ return state[SDL_SCANCODE_RIGHT] ? 0x8000 : 0 ;
716
+ case DVL_VK_DOWN:
717
+ return state[SDL_SCANCODE_DOWN] ? 0x8000 : 0 ;
718
+ default :
719
+ return 0 ;
709
720
}
710
- if (vKey == DVL_VK_MENU && state[SDL_SCANCODE_M]) {
711
- return 0x8000 ;
721
+ #else
722
+ const Uint8 *state = SDL_GetKeyState (nullptr );
723
+ switch (vKey) {
724
+ case DVL_VK_SHIFT:
725
+ return state[SDLK_LSHIFT] || state[SDLK_RSHIFT] ? 0x8000 : 0 ;
726
+ case DVL_VK_MENU:
727
+ return state[SDLK_MENU] ? 0x8000 : 0 ;
728
+ case DVL_VK_LEFT:
729
+ return state[SDLK_LEFT] ? 0x8000 : 0 ;
730
+ case DVL_VK_UP:
731
+ return state[SDLK_UP] ? 0x8000 : 0 ;
732
+ case DVL_VK_RIGHT:
733
+ return state[SDLK_RIGHT] ? 0x8000 : 0 ;
734
+ case DVL_VK_DOWN:
735
+ return state[SDLK_DOWN] ? 0x8000 : 0 ;
736
+ default :
737
+ return 0 ;
712
738
}
713
739
#endif
714
-
715
- return 0 ;
716
740
}
717
741
718
742
LRESULT DispatchMessageA (const MSG *lpMsg)
You can’t perform that action at this time.
0 commit comments