![]() |
nCine
2025.04.r498-9d36345
A cross-platform 2D game engine
|
It represents the interface to the graphics device where everything is rendered. More...
#include <IGfxDevice.h>
Classes | |
struct | GLContextInfo |
Contains the attributes to create an OpenGL context. More... | |
struct | Monitor |
A structure representing a connected monitor. More... | |
struct | VideoMode |
A structure representing a video mode supported by a monitor. More... | |
struct | WindowMode |
A structure used to initialize window properties. More... | |
Public Member Functions | |
IGfxDevice (const WindowMode &windowMode, const GLContextInfo &glContextInfo, const DisplayMode &displayMode) | |
virtual void | setSwapInterval (int interval)=0 |
Sets the number of vertical blanks to occur before a buffer swap. More... | |
bool | isFullScreen () const |
Returns true if the device renders in full screen. | |
virtual void | setFullScreen (bool fullScreen)=0 |
Sets the full screen flag of the window. | |
bool | isResizable () const |
Returns true if the window is resizable. | |
virtual int | windowPositionX () const |
Returns the window horizontal position. | |
virtual int | windowPositionY () const |
Returns the window vertical position. | |
virtual const Vector2i | windowPosition () const |
Returns the window position as a Vector2i object. | |
virtual void | setWindowPosition (int x, int y)=0 |
Sets the position of the application window with two integers. | |
void | setWindowPosition (Vector2i position) |
Sets the position of the application window with a Vector2i object. | |
int | width () const |
Returns the window or video mode width in screen coordinates. | |
int | height () const |
Returns the window or video mode height in screen coordinates. | |
Vector2i | resolution () const |
Returns the window or video mode resolution in screen coordinates as a Vector2i object. | |
Rectf | screenRect () const |
Returns the window or video mode resolution in screen coordinates as a Rectf object. | |
float | aspect () const |
Returns the window or video mode resolution aspect ratio. | |
virtual void | setWindowSize (int width, int height)=0 |
Sets the window size with two integers. More... | |
void | setWindowSize (Vector2i size) |
Sets the window size with a Vector2i object. More... | |
int | drawableWidth () const |
Returns the window width in pixels. More... | |
int | drawableHeight () const |
Returns the window height in pixels. More... | |
Vector2i | drawableResolution () const |
Returns the window resolution in pixels as a Vector2i object. | |
Rectf | drawableScreenRect () const |
Returns the window resolution in pixels as a Rectf object. | |
float | drawableAspect () const |
Returns the window drawable resolution aspect ratio. | |
virtual void | setWindowTitle (const char *windowTitle)=0 |
Sets the application window title. | |
virtual void | setWindowIcon (const char *windowIconFilename)=0 |
Sets the application window icon. | |
virtual void | flashWindow () const |
Highlights the application window to notify the user. | |
const GLContextInfo & | glContextInfo () const |
Returns the OpenGL context creation attributes. | |
const DisplayMode & | displayMode () const |
Returns display mode. | |
unsigned int | numMonitors () const |
Returns the number of connected monitors. | |
virtual unsigned int | primaryMonitorIndex () const |
Returns the array index of the primary monitor. More... | |
virtual unsigned int | windowMonitorIndex () const |
Returns the array index of the monitor associated with the window. | |
const Monitor & | monitor (unsigned int index) const |
Returns the specified monitor. | |
const Monitor & | monitor () const |
Returns the monitor that hosts the window. | |
virtual const VideoMode & | currentVideoMode (unsigned int monitorIndex) const =0 |
Returns the current video mode for the specified monitor. | |
const VideoMode & | currentVideoMode () const |
Returns the current video mode for the monitor that hosts the window. | |
virtual bool | setVideoMode (unsigned int modeIndex) |
Sets the video mode that will be used in full screen by the monitor that hosts the window. More... | |
float | windowScalingFactor () const |
Returns the scaling factor for application window. | |
Static Public Attributes | |
static const unsigned int | MaxMonitors = 4 |
static const unsigned int | MaxVideoModes = 128 |
Protected Member Functions | |
void | initWindowScaling (const WindowMode &windowMode) |
Scales the window size by the display factor before creating it for the first time. | |
void | initGLViewport () |
Inits the OpenGL viewport based on the drawable resolution. | |
int | containingMonitorIndex (int x, int y, int width, int height) const |
Returns the monitor index that contains the center of the specified rectangle, or -1 if its center is outside the virtual screen. More... | |
int | containingMonitorIndex (const Recti &rect) const |
Returns the monitor index that contains the center of the specified rectangle as a Recti object, or -1 if its center is outside the virtual screen. More... | |
int | containingMonitorIndex (const WindowMode &windowMode) const |
Returns the monitor index that contains the center of the specified rectangle as a WindowMode object, or -1 if its center is outside the virtual screen. More... | |
int | containingMonitorIndex (int x, int y) const |
Returns the monitor index that contains the specified point, or -1 if the point is outside the virtual screen. | |
int | containingMonitorIndex (const Vector2i &point) const |
Returns the monitor index that contains the specified point as a Vector2i object, or -1 if the point is outside the virtual screen. | |
virtual void | updateMonitors () |
Updates the array of connected monitors. | |
Protected Attributes | |
int | width_ |
Window width in screen coordinates. | |
int | height_ |
Window height in screen coordinates. | |
int | drawableWidth_ |
Window width in pixels (for HiDPI screens) | |
int | drawableHeight_ |
Window height in pixels (for HiDPI screens) | |
bool | isFullScreen_ |
Whether rendering occurs in full screen. | |
bool | isResizable_ |
Whether the window is resizable. | |
GLContextInfo | glContextInfo_ |
OpenGL context creation attributes. | |
DisplayMode | displayMode_ |
Display properties. | |
Monitor | monitors_ [MaxMonitors] |
unsigned int | numMonitors_ |
VideoMode | currentVideoMode_ |
Used as a cache to avoid searching the current video mode in a monitor's array. | |
bool | backendScalesWindowSize_ |
A flag indicating if the backend is responsible for scaling the window size. More... | |
float | previousScalingFactor_ |
The window scaling factor from last frame. | |
Static Protected Attributes | |
static const float | DefaultDpi = 96.0f |
The default value used for a monitor DPI when the real vaue cannot be queried. | |
Friends | |
class | Application |
It represents the interface to the graphics device where everything is rendered.
|
inlineprotected |
Returns the monitor index that contains the center of the specified rectangle as a Recti
object, or -1 if its center is outside the virtual screen.
x
and y
variables
|
inlineprotected |
Returns the monitor index that contains the center of the specified rectangle as a WindowMode
object, or -1 if its center is outside the virtual screen.
x
and y
variables
|
protected |
Returns the monitor index that contains the center of the specified rectangle, or -1 if its center is outside the virtual screen.
x
and y
variables
|
inline |
Returns the window height in pixels.
It may differs from height()
on HiDPI screens
|
inline |
Returns the window width in pixels.
It may differs from width()
on HiDPI screens
|
inlinevirtual |
Returns the array index of the primary monitor.
|
pure virtual |
Sets the number of vertical blanks to occur before a buffer swap.
An interval of -1
will enable adaptive v-sync if available
|
inlinevirtual |
Sets the video mode that will be used in full screen by the monitor that hosts the window.
|
pure virtual |
Sets the window size with two integers.
|
inline |
Sets the window size with a Vector2i
object.
|
protected |
A flag indicating if the backend is responsible for scaling the window size.
SDL_HINT_WINDOWS_DPI_SCALING
on SDL >= 2.24.0 and GLFW_SCALE_TO_MONITOR
on GLFW