Glfwx  0.1.0
C++ wrapper for GLFW
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Glfwx::Monitor Class Reference

C++ wrapper for a GLFW monitor. More...

#include <Glfwx/Monitor.h>

Public Types

using VideoMode = GLFWvidmode
 Video mode information. More...
 
using GammaRamp = GLFWgammaramp
 Gamma ramp specification.
 

Public Member Functions

 Monitor (GLFWmonitor *m)
 Constructor. More...
 
 operator GLFWmonitor * () const
 Implicit conversion to GLFWmonitor *.
 
void position (int *x, int *y) const
 Returns the position of the monitor's viewport on the virtual screen. More...
 
void workArea (int *x, int *y, int *width, int *height) const
 Returns the work area of the monitor. More...
 
void size (int *width, int *height) const
 Returns the physical size of the monitor. More...
 
void scale (float *x, float *y) const
 Returns the content scale for the monitor. More...
 
std::string name () const
 Returns the name of the monitor. More...
 
void setContext (void *context)
 Sets the user-defined context. More...
 
void * context () const
 Returns the user-defined context. More...
 
std::vector< VideoModeenumerateVideoModes () const
 Returns the available video modes for the monitor. More...
 
VideoMode videoMode () const
 Returns the current mode of the monitor. More...
 
void setGamma (float gamma)
 Generates a gamma ramp and sets it for the monitor. More...
 
void setGammaRamp (GammaRamp const &ramp)
 Sets the current gamma ramp for the monitor. More...
 
GammaRamp gammaRamp () const
 Returns the current gamma ramp for the monitor. More...
 

Static Public Member Functions

static std::vector< Monitorenumerate ()
 Returns a list of copies of the available monitors. More...
 
static Monitor primary ()
 Returns a copy of the primary monitor. More...
 
static void setConnectionChangedCallback (std::function< void(Monitor const &, bool)> const &cb)
 Sets the function to be called when the connection status of a monitor has changed. More...
 

Detailed Description

C++ wrapper for a GLFW monitor.

See also
GLFWmonitor
Warning
This implementation is provisional. Everything will probably be different once I figure out how it should really be implemented

Member Typedef Documentation

◆ VideoMode

using Glfwx::Monitor::VideoMode = GLFWvidmode

Video mode information.

See also
GLFWvidmode

Constructor & Destructor Documentation

◆ Monitor()

Glfwx::Monitor::Monitor ( GLFWmonitor *  m)
explicit

Constructor.

Parameters
mUnderlying GLFWmonitor

Member Function Documentation

◆ context()

void* Glfwx::Monitor::context ( ) const

Returns the user-defined context.

See also
glfwGetMonitorUserPointer

◆ enumerate()

static std::vector<Monitor> Glfwx::Monitor::enumerate ( )
static

Returns a list of copies of the available monitors.

Returns
List of copies of the available monitors
See also
glfwGetMonitors

◆ enumerateVideoModes()

std::vector<VideoMode> Glfwx::Monitor::enumerateVideoModes ( ) const

Returns the available video modes for the monitor.

Returns
List of available video modes
See also
glfwGetVideoModes

◆ gammaRamp()

GammaRamp Glfwx::Monitor::gammaRamp ( ) const

Returns the current gamma ramp for the monitor.

Returns
The current gamma ramp
See also
glfwGetGammaRamp

◆ name()

std::string Glfwx::Monitor::name ( ) const

Returns the name of the monitor.

Returns
The name of the monitor
See also
glfwGetMonitorName

◆ position()

void Glfwx::Monitor::position ( int *  x,
int *  y 
) const

Returns the position of the monitor's viewport on the virtual screen.

Parameters
xWhere to store the monitor x-coordinate, or nullptr
yWhere to store the monitor y-coordinate, or nullptr
See also
glfwGetMonitorPos

◆ primary()

static Monitor Glfwx::Monitor::primary ( )
static

Returns a copy of the primary monitor.

Returns
A copy of the primary monitor
See also
glfwGetPrimaryMonitor

◆ scale()

void Glfwx::Monitor::scale ( float *  x,
float *  y 
) const

Returns the content scale for the monitor.

Parameters
xWhere to store the x-axis content scale, or nullptr
yWhere to store the y-axis content scale, or nullptr
See also
glfwGetMonitorContentScale

◆ setConnectionChangedCallback()

static void Glfwx::Monitor::setConnectionChangedCallback ( std::function< void(Monitor const &, bool)> const &  cb)
static

Sets the function to be called when the connection status of a monitor has changed.

Parameters
cbCallback function
See also
glfwSetMonitorCallback

◆ setContext()

void Glfwx::Monitor::setContext ( void *  context)

Sets the user-defined context.

Parameters
contextUser-defined context
See also
glfwSetMonitorUserPointer

◆ setGamma()

void Glfwx::Monitor::setGamma ( float  gamma)

Generates a gamma ramp and sets it for the monitor.

Parameters
gammaThe desired exponent.
See also
glfwSetGamma

◆ setGammaRamp()

void Glfwx::Monitor::setGammaRamp ( GammaRamp const &  ramp)

Sets the current gamma ramp for the monitor.

Parameters
rampThe gamma ramp to use.
See also
glfwSetGammaRamp

◆ size()

void Glfwx::Monitor::size ( int *  width,
int *  height 
) const

Returns the physical size of the monitor.

Parameters
widthWhere to store the width, in millimetres, of the monitor's display area, or nullptr
heightWhere to store the height, in millimetres, of the monitor's display area, or nullptr
See also
glfwGetMonitorPhysicalSize

◆ videoMode()

VideoMode Glfwx::Monitor::videoMode ( ) const

Returns the current mode of the monitor.

Returns
The current mode of the monitor
See also
glfwGetVideoMode

◆ workArea()

void Glfwx::Monitor::workArea ( int *  x,
int *  y,
int *  width,
int *  height 
) const

Returns the work area of the monitor.

Parameters
xWhere to store the monitor x-coordinate, or nullptr
yWhere to store the monitor y-coordinate, or nullptr
widthWhere to store the monitor width, or nullptr
heightWhere to store the monitor height, or nullptr
See also
glfwGetMonitorWorkarea