diff --git a/include/input.h b/include/input.h index bc268f9..0a95b29 100644 --- a/include/input.h +++ b/include/input.h @@ -146,6 +146,7 @@ void mouse_get_pos(int *x, int *y); void mouse_set_pos(int x, int y); void mouse_get_wheel(int *forward, int *back); void mouse_clear_wheel(void); +bool mouse_show_cursor(bool show); void register_input_handler(void(*handler)(const char*)); void clear_input_handler(void); void register_editing_handler(void(*handler)(const char*, int, int)); diff --git a/src/hll/SystemService.c b/src/hll/SystemService.c index f952bad..c686b1c 100644 --- a/src/hll/SystemService.c +++ b/src/hll/SystemService.c @@ -18,6 +18,7 @@ #include "system4/string.h" +#include "input.h" #include "mixer.h" #include "xsystem4.h" #include "hll.h" @@ -71,8 +72,17 @@ static int SystemService_GetViewHeight(void) return config.view_height; } -//bool SystemService_MoveMouseCursorPosImmediately(int nX, int nY); -//bool SystemService_SetHideMouseCursorByGame(bool bHide); +static bool SystemService_MoveMouseCursorPosImmediately(int x, int y) +{ + mouse_set_pos(x, y); + return true; +} + +static bool SystemService_SetHideMouseCursorByGame(bool hide) +{ + return mouse_show_cursor(!hide); +} + //bool SystemService_GetHideMouseCursorByGame(void); //bool SystemService_SetUsePower2Texture(bool bUse); //bool SystemService_GetUsePower2Texture(void); @@ -185,8 +195,8 @@ HLL_LIBRARY(SystemService, HLL_TODO_EXPORT(UpdateView, SystemService_UpdateView), HLL_EXPORT(GetViewWidth, SystemService_GetViewWidth), HLL_EXPORT(GetViewHeight, SystemService_GetViewHeight), - HLL_TODO_EXPORT(MoveMouseCursorPosImmediately, SystemService_MoveMouseCursorPosImmediately), - HLL_TODO_EXPORT(SetHideMouseCursorByGame, SystemService_SetHideMouseCursorByGame), + HLL_EXPORT(MoveMouseCursorPosImmediately, SystemService_MoveMouseCursorPosImmediately), + HLL_EXPORT(SetHideMouseCursorByGame, SystemService_SetHideMouseCursorByGame), HLL_TODO_EXPORT(GetHideMouseCursorByGame, SystemService_GetHideMouseCursorByGame), HLL_TODO_EXPORT(SetUsePower2Texture, SystemService_SetUsePower2Texture), HLL_TODO_EXPORT(GetUsePower2Texture, SystemService_GetUsePower2Texture), diff --git a/src/input.c b/src/input.c index ee2aebf..75317f8 100644 --- a/src/input.c +++ b/src/input.c @@ -235,6 +235,11 @@ void mouse_clear_wheel(void) wheel_dir = 0; } +bool mouse_show_cursor(bool show) +{ + return SDL_ShowCursor(show ? SDL_ENABLE : SDL_DISABLE) >= 0; +} + static void key_event(SDL_KeyboardEvent *e, bool pressed) { if (e->keysym.scancode >= (sizeof(sdl_keytable)/sizeof(*sdl_keytable)))