From f463d71217c08f91c8b2d90f75c4d02afc9ff4f5 Mon Sep 17 00:00:00 2001 From: Spitko Date: Mon, 8 Apr 2024 03:49:53 -0700 Subject: [PATCH] Add support for SDL_GetGlobalMouseState (#672) --- libs/sdl/sdl.c | 5 +++++ libs/sdl/sdl/Sdl.hx | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libs/sdl/sdl.c b/libs/sdl/sdl.c index 7422dcb4a..212e20e20 100644 --- a/libs/sdl/sdl.c +++ b/libs/sdl/sdl.c @@ -475,6 +475,10 @@ HL_PRIM bool HL_NAME(get_window_grab)(SDL_Window* window) { return SDL_GetWindowGrab(window); } +HL_PRIM int HL_NAME(get_global_mouse_state)(int* x, int* y) { + return SDL_GetGlobalMouseState(x, y); +} + HL_PRIM const char *HL_NAME(detect_keyboard_layout)() { char q = SDL_GetKeyFromScancode(SDL_SCANCODE_Q); char w = SDL_GetKeyFromScancode(SDL_SCANCODE_W); @@ -509,6 +513,7 @@ DEFINE_PRIM(_I32, warp_mouse_global, _I32 _I32); DEFINE_PRIM(_VOID, warp_mouse_in_window, TWIN _I32 _I32); DEFINE_PRIM(_VOID, set_window_grab, TWIN _BOOL); DEFINE_PRIM(_BOOL, get_window_grab, TWIN); +DEFINE_PRIM(_I32, get_global_mouse_state, _REF(_I32) _REF(_I32)); DEFINE_PRIM(_BYTES, detect_keyboard_layout, _NO_ARG); DEFINE_PRIM(_BOOL, hint_value, _BYTES _BYTES); diff --git a/libs/sdl/sdl/Sdl.hx b/libs/sdl/sdl/Sdl.hx index d9bd19fbd..44d4e0db5 100644 --- a/libs/sdl/sdl/Sdl.hx +++ b/libs/sdl/sdl/Sdl.hx @@ -220,6 +220,11 @@ class Sdl { return 0; } + @:hlNative("?sdl", "get_global_mouse_state") + public static function getGlobalMouseState( x : hl.Ref, y : hl.Ref ) : Int { + return 0; + } + static function detect_keyboard_layout() : hl.Bytes { return null; }