SdlGfxDevice class
#include <nCine/Backends/SdlGfxDevice.h>
SDL2-based graphics device.
Manages the application window and OpenGL context using the SDL2 library.
Base classes
- class nCine::IGfxDevice
- Represents the interface to the graphics device where everything is rendered.
Public static functions
-
static auto isMainWindow(std::
uint32_t windowId) -> bool - Returns
trueif the specified window ID refers to the main window. - static auto windowHandle() -> SDL_Window*
- Returns the SDL2 handle of the main window.
- static auto glContextHandle() -> SDL_GLContext
- Returns the SDL2 OpenGL context handle.
Constructors, destructors, conversion operators
- SdlGfxDevice(const WindowMode& windowMode, const GLContextInfo& glContextInfo, const DisplayMode& displayMode)
- ~SdlGfxDevice() override
Public functions
- void setSwapInterval(int interval) override
- Sets the number of vertical blanks to occur before a buffer swap.
- void setResolution(bool fullscreen, int width = 0, int height = 0) override
- Sets the screen resolution with two integers.
- void update() override
- Updates the screen by swapping the back and front buffers.
- void setWindowPosition(int x, int y) override
- Sets the position of the application window with two integers.
- void setWindowSize(int width, int height) override
- Sets the window size with two integers.
- void setWindowTitle(StringView windowTitle) override
- Sets the application window title.
- void setWindowIcon(StringView iconFilename) override
- Sets the application window icon.
- auto windowPosition() const -> const Vector2i override
- Returns the window position as a
Vector2iobject. - void flashWindow() const override
- Highlights the application window to notify the user.
- auto windowMonitorIndex() const -> unsigned int override
- Returns the array index of the monitor associated with the window.
- auto currentVideoMode(unsigned int monitorIndex) const -> const VideoMode& override
- Returns the current video mode for the specified monitor.
- auto setVideoMode(unsigned int modeIndex) -> bool override
- Sets the video mode used in full screen by the monitor that hosts the window.
Protected functions
- void setResolutionInternal(int width, int height) override
- void updateMonitors() override
- Updates the array of connected monitors.
Function documentation
static bool nCine:: Backends:: SdlGfxDevice:: isMainWindow(std:: uint32_t windowId)
Returns true if the specified window ID refers to the main window.
| Parameters | |
|---|---|
| windowId | SDL2 window identifier to compare against the main window |
void nCine:: Backends:: SdlGfxDevice:: setSwapInterval(int interval) override
Sets the number of vertical blanks to occur before a buffer swap.
An interval of -1 will enable adaptive v-sync if available.
void nCine:: Backends:: SdlGfxDevice:: setWindowSize(int width,
int height) override
Sets the window size with two integers.
bool nCine:: Backends:: SdlGfxDevice:: setVideoMode(unsigned int modeIndex) override
Sets the video mode used in full screen by the monitor that hosts the window.