Skip to content

Commit

Permalink
Add support for SDL_GetGlobalMouseState (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
nspitko authored Apr 8, 2024
1 parent 542037a commit f463d71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/sdl/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions libs/sdl/sdl/Sdl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ class Sdl {
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 {
return null;
}
Expand Down

0 comments on commit f463d71

Please sign in to comment.