소스 검색

Fix mouse button order for SDL (#3534)

pull/3539/head
ubkp 2 년 전
committed by GitHub
부모
커밋
87f26c845c
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
1개의 변경된 파일14개의 추가작업 그리고 2개의 파일을 삭제
  1. +14
    -2
      src/platforms/rcore_desktop_sdl.c

+ 14
- 2
src/platforms/rcore_desktop_sdl.c 파일 보기

@ -1084,14 +1084,26 @@ void PollInputEvents(void)
// Check mouse events
case SDL_MOUSEBUTTONDOWN:
{
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 1;
// NOTE: SDL2 mouse button order is LEFT, MIDDLE, RIGHT, but raylib uses LEFT, RIGHT, MIDDLE like GLFW
// The following conditions align SDL with raylib.h MouseButton enum order
int btn = event.button.button - 1;
if (btn == 2) btn = 1;
else if (btn == 1) btn = 2;
CORE.Input.Mouse.currentButtonState[btn] = 1;
touchAction = 1;
gestureUpdate = true;
} break;
case SDL_MOUSEBUTTONUP:
{
CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 0;
// NOTE: SDL2 mouse button order is LEFT, MIDDLE, RIGHT, but raylib uses LEFT, RIGHT, MIDDLE like GLFW
// The following conditions align SDL with raylib.h MouseButton enum order
int btn = event.button.button - 1;
if (btn == 2) btn = 1;
else if (btn == 1) btn = 2;
CORE.Input.Mouse.currentButtonState[btn] = 0;
touchAction = 0;
gestureUpdate = true;

불러오는 중...
취소
저장