diff --git a/src/platform/linux.c b/src/platform/linux.c index 32832d3c33..cb8b405004 100644 --- a/src/platform/linux.c +++ b/src/platform/linux.c @@ -531,32 +531,6 @@ bool platform_file_delete(const utf8 *path) return 0; } -void platform_hide_cursor() -{ - STUB(); -} - -void platform_show_cursor() -{ - STUB(); -} - -void platform_get_cursor_position(int *x, int *y) -{ - STUB(); -} - -void platform_set_cursor_position(int x, int y) -{ - STUB(); -} - -unsigned int platform_get_ticks() -{ - STUB(); - return 100; -} - wchar_t *regular_to_wchar(const char* src) { int len = strnlen(src, MAX_PATH); diff --git a/src/platform/shared.c b/src/platform/shared.c index 3bb73a91ff..fa8ffcbbf2 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -907,3 +907,28 @@ static void platform_refresh_screenbuffer(int width, int height, int pitch) RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) = (width >> 6) + 1; RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, uint32) = (height >> 3) + 1; } + +void platform_hide_cursor() +{ + SDL_ShowCursor(SDL_DISABLE); +} + +void platform_show_cursor() +{ + SDL_ShowCursor(SDL_ENABLE); +} + +void platform_get_cursor_position(int *x, int *y) +{ + SDL_GetMouseState(x, y); +} + +void platform_set_cursor_position(int x, int y) +{ + SDL_WarpMouseInWindow(NULL, x, y); +} + +unsigned int platform_get_ticks() +{ + return SDL_GetTicks(); +} \ No newline at end of file diff --git a/src/platform/windows.c b/src/platform/windows.c index dc0469392f..653bef75ba 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -378,39 +378,6 @@ bool platform_file_delete(const utf8 *path) return success == TRUE; } -void platform_hide_cursor() -{ - ShowCursor(FALSE); -} - -void platform_show_cursor() -{ - ShowCursor(TRUE); -} - -void platform_get_cursor_position(int *x, int *y) -{ - POINT point; - - if (GetCursorPos(&point)) { - *x = point.x; - *y = point.y; - } else { - *x = INT32_MIN; - *y = INT32_MIN; - } -} - -void platform_set_cursor_position(int x, int y) -{ - SetCursorPos(x, y); -} - -unsigned int platform_get_ticks() -{ - return GetTickCount(); -} - void platform_get_user_directory(utf8 *outPath, const utf8 *subDirectory) { wchar_t wOutPath[MAX_PATH];