Browse Source

Add support for SDL_GetGlobalMouseState (#672)

Spitko 1 year ago
parent
commit
f463d71217
2 changed files with 10 additions and 0 deletions
  1. 5 0
      libs/sdl/sdl.c
  2. 5 0
      libs/sdl/sdl/Sdl.hx

+ 5 - 0
libs/sdl/sdl.c

@@ -475,6 +475,10 @@ HL_PRIM bool HL_NAME(get_window_grab)(SDL_Window* window) {
 	return SDL_GetWindowGrab(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)() {
 HL_PRIM const char *HL_NAME(detect_keyboard_layout)() {
 	char q = SDL_GetKeyFromScancode(SDL_SCANCODE_Q);
 	char q = SDL_GetKeyFromScancode(SDL_SCANCODE_Q);
 	char w = SDL_GetKeyFromScancode(SDL_SCANCODE_W);
 	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, warp_mouse_in_window, TWIN _I32 _I32);
 DEFINE_PRIM(_VOID, set_window_grab, TWIN _BOOL);
 DEFINE_PRIM(_VOID, set_window_grab, TWIN _BOOL);
 DEFINE_PRIM(_BOOL, get_window_grab, TWIN);
 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(_BYTES, detect_keyboard_layout, _NO_ARG);
 DEFINE_PRIM(_BOOL, hint_value, _BYTES _BYTES);
 DEFINE_PRIM(_BOOL, hint_value, _BYTES _BYTES);
 
 

+ 5 - 0
libs/sdl/sdl/Sdl.hx

@@ -220,6 +220,11 @@ class Sdl {
 		return 0;
 		return 0;
 	}
 	}
 
 
+	@:hlNative("?sdl", "get_global_mouse_state")
+	public static function getGlobalMouseState( x : hl.Ref<Int>, y : hl.Ref<Int> ) : Int {
+		return 0;
+	}
+
 	static function detect_keyboard_layout() : hl.Bytes {
 	static function detect_keyboard_layout() : hl.Bytes {
 		return null;
 		return null;
 	}
 	}