From 1435962bedea8070ae3f4d91fb3129e78f14018c Mon Sep 17 00:00:00 2001 From: Naomino <66085784+Naomi-Kali@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:58:26 +0200 Subject: [PATCH] Hide Cursor Hiding Cursor implemented --- src/sdl_window.cpp | 12 +++++++++++- src/sdl_window.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index d4da268af..05bd190b7 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -11,9 +11,18 @@ #include "core/libraries/pad/pad.h" #include "input/controller.h" #include "sdl_window.h" +#include namespace Frontend { +void WindowSDL::CursorVisibility(bool cursor_visibility) { + if (cursor_visibility) { + SDL_HideCursor(); + } else { + SDL_ShowCursor(); + } +} + WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_) : width{width_}, height{height_}, controller{controller_} { if (SDL_Init(SDL_INIT_VIDEO) < 0) { @@ -36,6 +45,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_ } SDL_SetWindowFullscreen(window, Config::isFullscreenMode()); + CursorVisibility(true); #if defined(SDL_PLATFORM_WIN32) window_info.type = WindowSystemType::Windows; @@ -248,4 +258,4 @@ void WindowSDL::onKeyPress(const SDL_Event* event) { } } -} // namespace Frontend +} // namespace Frontend \ No newline at end of file diff --git a/src/sdl_window.h b/src/sdl_window.h index 13ee78649..e0995218c 100644 --- a/src/sdl_window.h +++ b/src/sdl_window.h @@ -63,6 +63,7 @@ public: private: void onResize(); void onKeyPress(const SDL_Event* event); + void CursorVisibility(bool cursor_visibility); private: s32 width;