Hide Cursor

Hiding Cursor implemented
This commit is contained in:
Naomino 2024-07-07 19:58:26 +02:00
parent 5602debb22
commit 1435962bed
2 changed files with 12 additions and 1 deletions

View File

@ -11,9 +11,18 @@
#include "core/libraries/pad/pad.h" #include "core/libraries/pad/pad.h"
#include "input/controller.h" #include "input/controller.h"
#include "sdl_window.h" #include "sdl_window.h"
#include <SDL3/SDL_mouse.h>
namespace Frontend { 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_) WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_)
: width{width_}, height{height_}, controller{controller_} { : width{width_}, height{height_}, controller{controller_} {
if (SDL_Init(SDL_INIT_VIDEO) < 0) { 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()); SDL_SetWindowFullscreen(window, Config::isFullscreenMode());
CursorVisibility(true);
#if defined(SDL_PLATFORM_WIN32) #if defined(SDL_PLATFORM_WIN32)
window_info.type = WindowSystemType::Windows; window_info.type = WindowSystemType::Windows;
@ -248,4 +258,4 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
} }
} }
} // namespace Frontend } // namespace Frontend

View File

@ -63,6 +63,7 @@ public:
private: private:
void onResize(); void onResize();
void onKeyPress(const SDL_Event* event); void onKeyPress(const SDL_Event* event);
void CursorVisibility(bool cursor_visibility);
private: private:
s32 width; s32 width;