Skip to content

Commit

Permalink
add utility get cursor window position
Browse files Browse the repository at this point in the history
  • Loading branch information
cklosters committed Dec 5, 2022
1 parent 8af0e1c commit 470c1c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/naprender/src/sdlhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions modules/naprender/src/sdlhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
1 change: 1 addition & 0 deletions utility/src/utility/fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 470c1c8

Please sign in to comment.