Implement two SystemService.dll functions

For Widenyo.
This commit is contained in:
kichikuou
2022-03-24 22:00:35 +09:00
parent 1e3bf3507a
commit a76948244e
3 changed files with 20 additions and 4 deletions
+1
View File
@@ -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));
+14 -4
View File
@@ -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),
+5
View File
@@ -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)))