From 470c1c879a19bb8947325e01737beb5a893079b2 Mon Sep 17 00:00:00 2001 From: cklosters Date: Mon, 5 Dec 2022 16:18:13 +0100 Subject: [PATCH] add utility get cursor window position --- modules/naprender/src/sdlhelpers.cpp | 8 ++++++++ modules/naprender/src/sdlhelpers.h | 6 ++++++ utility/src/utility/fileutils.h | 1 + 3 files changed, 15 insertions(+) diff --git a/modules/naprender/src/sdlhelpers.cpp b/modules/naprender/src/sdlhelpers.cpp index 884b9553bc..5ba1404dc8 100644 --- a/modules/naprender/src/sdlhelpers.cpp +++ b/modules/naprender/src/sdlhelpers.cpp @@ -201,6 +201,14 @@ namespace nap } + glm::ivec2 getCursorPosition() + { + glm::ivec2 pos; + SDL_GetMouseState(&pos.x, &pos.y); + return pos; + } + + bool getFullscreen(SDL_Window* window) { uint32 flags = SDL_GetWindowFlags(window); diff --git a/modules/naprender/src/sdlhelpers.h b/modules/naprender/src/sdlhelpers.h index 1ba14b352b..7d8ac778fd 100644 --- a/modules/naprender/src/sdlhelpers.h +++ b/modules/naprender/src/sdlhelpers.h @@ -164,6 +164,12 @@ namespace nap */ void NAPAPI showCursor(); + /** + * Returns the mouse cursor position relative to the focus window for the currently selected mouse. + * @return cursor position relative to the focus window + */ + glm::ivec2 NAPAPI getCursorPosition(); + /** * Initializes SDL video system. * Call this before creating any windows or render contexts! diff --git a/utility/src/utility/fileutils.h b/utility/src/utility/fileutils.h index 6a7984f66f..9fe68e486b 100644 --- a/utility/src/utility/fileutils.h +++ b/utility/src/utility/fileutils.h @@ -129,6 +129,7 @@ namespace nap bool makeDirs(const std::string& directory); /** + * Delete the file at the specified path * Delete the file at the specified path * @param path The path to the file to delete * @return true on success, false if it failed