Typedefs | |
| using | SurfacePtr = std::unique_ptr< SDL_Surface, std::function< void(SDL_Surface *)> > |
Functions | |
| void NAPAPI | showWindow (SDL_Window *window, bool show) |
| void NAPAPI | raiseWindow (SDL_Window *window) |
| bool NAPAPI | setFullscreen (SDL_Window *window, bool value) |
| bool NAPAPI | getFullscreen (SDL_Window *window) |
| glm::ivec2 NAPAPI | getWindowSize (SDL_Window *window) |
| uint32 NAPAPI | getWindowFlags (SDL_Window *window) |
| glm::ivec2 NAPAPI | getScreenSize (int screenIndex) |
| void NAPAPI | setWindowSize (SDL_Window *window, const glm::ivec2 &size) |
| glm::ivec2 NAPAPI | getDrawableWindowSize (SDL_Window *window) |
| glm::ivec2 NAPAPI | getWindowPosition (SDL_Window *window) |
| bool NAPAPI | setWindowPosition (SDL_Window *window, const glm::ivec2 &position) |
| void NAPAPI | shutdownVideo () |
| std::string NAPAPI | getSDLError () |
| uint32_t NAPAPI | getWindowId (SDL_Window *window) |
| int NAPAPI | getDisplayCount () |
| NAPAPI std::vector< int > | getDisplayIDs () |
| NAPAPI std::vector< nap::Display > | getDisplays () |
| int NAPAPI | getDisplayIndex (SDL_Window *window) |
| bool NAPAPI | getDisplayName (int displayIndex, std::string &outName) |
| bool NAPAPI | getDisplayBounds (int displayIndex, glm::ivec2 &outMin, glm::ivec2 &outMax) |
| bool NAPAPI | getDisplayContentScale (int displayIndex, float *scale) |
| bool NAPAPI | getDisplayContentScale (SDL_Window *window, float *scale) |
| Display::EOrientation NAPAPI | getDisplayOrientation (int displayIndex) |
| bool NAPAPI | getWindowPixelDensity (SDL_Window *window, float *density) |
| bool NAPAPI | getWindowDisplayScale (SDL_Window *window, float *scale) |
| void NAPAPI | hideCursor () |
| void NAPAPI | showCursor () |
| bool NAPAPI | cursorVisible () |
| void NAPAPI | toggleCursor () |
| glm::vec2 NAPAPI | getCursorPosition () |
| glm::vec2 NAPAPI | getGlobalCursorPosition () |
| uint32 NAPAPI | getMouseState (float *x, float *y) |
| uint32 NAPAPI | getGlobalMouseState (float *x, float *y) |
| NAPAPI std::vector< std::string > | getVideoDrivers () |
| NAPAPI std::string | getCurrentVideoDriver () |
| bool NAPAPI | initVideo (utility::ErrorState &error) |
| bool NAPAPI | initVideo (EVideoDriver driver, utility::ErrorState &error) |
| bool NAPAPI | videoInitialized () |
| void NAPAPI | setWindowBordered (SDL_Window *window, bool hasBorders) |
| void NAPAPI | setWindowTitle (SDL_Window *window, const std::string &name) |
| void NAPAPI | setWindowAlwaysOnTop (SDL_Window *window, bool enabled) |
| void NAPAPI | setWindowResizable (SDL_Window *window, bool enabled) |
| NAPAPI SurfacePtr | createSurface (const std::string &imagePath, utility::ErrorState &error) |
| bool NAPAPI | enableTextInput (SDL_Window *window) |
| bool NAPAPI | disableTextInput (SDL_Window *window) |
| using SurfacePtr = std::unique_ptr<SDL_Surface, std::function<void(SDL_Surface*)> > |
Create a 4 channel (RGBA) pixel surface from image on disk. RGB images are converted to RGBA, where the alpha channel is initialized to '255'.
| imagePath | absolute path to image on disk |
| error | the error if creation fails |
| NAPAPI SurfacePtr nap::SDL::createSurface | ( | const std::string & | imagePath, |
| utility::ErrorState & | error | ||
| ) |
| bool NAPAPI nap::SDL::cursorVisible | ( | ) |
Returns if the cursor is visible
| bool NAPAPI nap::SDL::disableTextInput | ( | SDL_Window * | window | ) |
Stop accepting Unicode text input events in a window.
| window | the window to enable text input from |
| bool NAPAPI nap::SDL::enableTextInput | ( | SDL_Window * | window | ) |
Start accepting Unicode text input events in a window.
| window | the window to enable text input from |
| NAPAPI std::string nap::SDL::getCurrentVideoDriver | ( | ) |
| glm::vec2 NAPAPI nap::SDL::getCursorPosition | ( | ) |
Returns the mouse cursor position relative to the focus window.
| bool NAPAPI nap::SDL::getDisplayBounds | ( | int | displayIndex, |
| glm::ivec2 & | outMin, | ||
| glm::ivec2 & | outMax | ||
| ) |
Gets desktop area represented by a display, with the primary display located at 0,0
| displayIndex | index of the display to get the bounds for |
| outMin | min position of desktop area represented by a display, with the primary display located at 0,0 |
| outMax | max position of desktop area represented by a display, with the primary display located at 0,0 |
| bool NAPAPI nap::SDL::getDisplayContentScale | ( | int | displayIndex, |
| float * | scale | ||
| ) |
Get the content scale of a display.
The content scale is the expected scale for content based on the DPI settings of the display. For example, a 4K display might have a 2.0 (200%) display scale, which means that the user expects UI elements to be twice as big on this display, to aid in readability.
SDL_GetWindowDisplayScale() should be used to query the content scale factor for individual windows, instead of querying the display for a window and calling this function, as the per-window content scale factor may differ from the base value of the display it is on, particularly on high-DPI and/or multi-monitor desktop configurations.
| displayIndex | The index of the display |
| scale | the returned scale, 0.0 if call fails |
| bool NAPAPI nap::SDL::getDisplayContentScale | ( | SDL_Window * | window, |
| float * | scale | ||
| ) |
Get the content scale of a display.
The content scale is the expected scale for content based on the DPI settings of the display. For example, a 4K display might have a 2.0 (200%) display scale, which means that the user expects UI elements to be twice as big on this display, to aid in readability.
SDL_GetWindowDisplayScale() should be used to query the content scale factor for individual windows, instead of querying the display for a window and calling this function, as the per-window content scale factor may differ from the base value of the display it is on, particularly on high-DPI and/or multi-monitor desktop configurations.
| window | the window to get the content scale for |
| scale | the display content scaling factor, 0.0 if call fails |
| int NAPAPI nap::SDL::getDisplayCount | ( | ) |
Get the number of available video displays.
| NAPAPI std::vector<int> nap::SDL::getDisplayIDs | ( | ) |
Returns list of unique display ids, 0 on failure
| int NAPAPI nap::SDL::getDisplayIndex | ( | SDL_Window * | window | ) |
Get the unique index of the display associated with a window.
| window | the window to get the display index for |
| bool NAPAPI nap::SDL::getDisplayName | ( | int | displayIndex, |
| std::string & | outName | ||
| ) |
| displayIndex | index of display to get name for |
| outName | display name for given display index |
| Display::EOrientation NAPAPI nap::SDL::getDisplayOrientation | ( | int | displayIndex | ) |
@reutn the way a display is rotated.
| NAPAPI std::vector<nap::Display> nap::SDL::getDisplays | ( | ) |
Returns a list of currently attached displays.
| glm::ivec2 NAPAPI nap::SDL::getDrawableWindowSize | ( | SDL_Window * | window | ) |
Returns the actual size in pixels of a window, which can be different from the represented window size. This is the case with High DPI screens on OSX
| bool NAPAPI nap::SDL::getFullscreen | ( | SDL_Window * | window | ) |
Returns if the window is full screen (Desktop)
| glm::vec2 NAPAPI nap::SDL::getGlobalCursorPosition | ( | ) |
Get the position of the cursor, in relation to the desktop. This works just like getCursorPosition(), but the coordinates will be reported relative to the top-left of the desktop. Current position of the cursor, in relation to the desktop
| uint32 NAPAPI nap::SDL::getGlobalMouseState | ( | float * | x, |
| float * | y | ||
| ) |
Get the current state of the mouse, in relation to the desktop. This works just like getMouseState(), but the coordinates will be reported relative to the top-left of the desktop.
| x | the current x coordinate, relative to the desktop. Can be nullptr |
| y | the current y coordinate, relative to the desktop. Can be nullptr |
| uint32 NAPAPI nap::SDL::getMouseState | ( | float * | x, |
| float * | y | ||
| ) |
Get the current state of the mouse relative to the focus window.
| x | the current x coordinate. Can be nullptr |
| y | the current y coordinate. Can be nullptr |
| glm::ivec2 NAPAPI nap::SDL::getScreenSize | ( | int | screenIndex | ) |
| screenIndex | the number of the display |
| std::string NAPAPI nap::SDL::getSDLError | ( | ) |
@ return the last SDL error as a string
| NAPAPI std::vector<std::string> nap::SDL::getVideoDrivers | ( | ) |
Get all available video drivers.
| bool NAPAPI nap::SDL::getWindowDisplayScale | ( | SDL_Window * | window, |
| float * | scale | ||
| ) |
Get the content display scale relative to a window's pixel size.
This is a combination of the window pixel density and the display content scale, and is the expected scale for displaying content in this window. For example, if a 3840x2160 window had a display scale of 2.0, the user expects the content to take twice as many pixels and be the same physical size as if it were being displayed in a 1920x1080 window with a display scale of 1.0.
Conceptually this value corresponds to the scale display setting, and is updated when that setting is changed, or the window moves to a display with a different scale setting.
| window | the window to get the content scale for |
| scale | the window content scale, 0.0 if call fails |
| uint32 NAPAPI nap::SDL::getWindowFlags | ( | SDL_Window * | window | ) |
| window | the window to get the flags for |
| uint32_t NAPAPI nap::SDL::getWindowId | ( | SDL_Window * | window | ) |
| bool NAPAPI nap::SDL::getWindowPixelDensity | ( | SDL_Window * | window, |
| float * | density | ||
| ) |
Get the pixel density of a window, this is a ratio of pixel size to window size.
For example, if the window is 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it would have a pixel density of 2.0.
| window | the window to get the pixel density for |
| density | the window pixel density, 0.0 if call fails |
| glm::ivec2 NAPAPI nap::SDL::getWindowPosition | ( | SDL_Window * | window | ) |
returns the window position as pixel coordinates
| window | the window to get the position for |
| glm::ivec2 NAPAPI nap::SDL::getWindowSize | ( | SDL_Window * | window | ) |
Returns the size of an SDL window
| window | the window to retrieve the size for |
| void NAPAPI nap::SDL::hideCursor | ( | ) |
Hides the mouse cursor
| bool NAPAPI nap::SDL::initVideo | ( | EVideoDriver | driver, |
| utility::ErrorState & | error | ||
| ) |
Initializes the SDL video system using the given driver. Call this before creating any windows or render contexts!
| driver | video back-end driver, call fails if driver is not available. |
| bool NAPAPI nap::SDL::initVideo | ( | utility::ErrorState & | error | ) |
Initializes SDL video system. Call this before creating any windows or render contexts!
| void NAPAPI nap::SDL::raiseWindow | ( | SDL_Window * | window | ) |
Makes sure the window is on top and receives input focus.
| window | the window to raise |
| bool NAPAPI nap::SDL::setFullscreen | ( | SDL_Window * | window, |
| bool | value | ||
| ) |
Sets the window to be full screen in desktop mode
| window | the window to enable / disable |
| value | if the window is full screen |
| void NAPAPI nap::SDL::setWindowAlwaysOnTop | ( | SDL_Window * | window, |
| bool | enabled | ||
| ) |
Brings the window to the front and keeps it there
| window | the window to move to the front and keep on top |
| enabled | if always on top should be enabled |
| void NAPAPI nap::SDL::setWindowBordered | ( | SDL_Window * | window, |
| bool | hasBorders | ||
| ) |
Controls if the window has any borders.
| window | the window to set |
| hasBorders | if the window should have borders |
| bool NAPAPI nap::SDL::setWindowPosition | ( | SDL_Window * | window, |
| const glm::ivec2 & | position | ||
| ) |
Set the position of a window on screen.
| window | the window to set the position for |
| position | the window location in pixels |
| void NAPAPI nap::SDL::setWindowResizable | ( | SDL_Window * | window, |
| bool | enabled | ||
| ) |
Turn resizing of a window by a user on or off.
| window | the resize window |
| enabled | resize flag |
| void NAPAPI nap::SDL::setWindowSize | ( | SDL_Window * | window, |
| const glm::ivec2 & | size | ||
| ) |
resizes an SDL window
| window | the window to resize |
| size | the new window size |
| void NAPAPI nap::SDL::setWindowTitle | ( | SDL_Window * | window, |
| const std::string & | name | ||
| ) |
Sets the window title.
| window | the window to set the title for |
| name | the new window name |
| void NAPAPI nap::SDL::showCursor | ( | ) |
Shows the mouse cursor
| void NAPAPI nap::SDL::showWindow | ( | SDL_Window * | window, |
| bool | show | ||
| ) |
Makes a window visible.
| window | pointer to the window to make visible. |
| show | if the window is shown or hidden |
| void NAPAPI nap::SDL::shutdownVideo | ( | ) |
Shutdown SDL
| void NAPAPI nap::SDL::toggleCursor | ( | ) |
Toggles cursor visibility on / off
| bool NAPAPI nap::SDL::videoInitialized | ( | ) |
Returns if the video subsystem has been initialized