NAP
Public Types | Public Member Functions | List of all members
Display Class Referencefinal

#include <display.h>

Public Types

enum  EOrientation : int8 {
  Unknown = 0, Landscape = 1, LandscapeFlipped = 2, Portrait = 3,
  PortraitFlipped = 4
}
 

Public Member Functions

 Display ()=default
 
 Display (int index)
 
bool isValid () const
 
int getIndex () const
 
const std::string & getName () const
 
const glm::ivec2 & getMin () const
 
const glm::ivec2 & getMax () const
 
math::Rect getBounds () const
 
float getContentScale () const
 
float getDPI () const
 
EOrientation getOrientation () const
 
float getDiagonalDPI () const
 
float getHorizontalDPI () const
 
float getVerticalDPI () const
 
std::string toString () const
 
bool operator== (const Display &rhs) const
 
bool operator!= (const Display &rhs) const
 

Description

Display information.

The information provided by this interface isn't required to remain valid. When a display is re-connected, or even turned on/off, the index is re-assigned and this object becomes invalid.

Member Enumeration Documentation

◆ EOrientation

enum EOrientation : int8
strong

Display orientation modes

Enumerator
Unknown 
Landscape 
LandscapeFlipped 
Portrait 
PortraitFlipped 

Constructor & Destructor Documentation

◆ Display() [1/2]

Display ( )
default

Construct a default, invalid display

◆ Display() [2/2]

Display ( int  index)

Construct display information, index must be >= 0.

Parameters
indexdisplay index

Member Function Documentation

◆ getBounds()

math::Rect getBounds ( ) const
Returns
desktop area of this display, with the primary display located at 0,0

◆ getContentScale()

float getContentScale ( ) const

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.

Returns
content scale of the display

◆ getDiagonalDPI()

float getDiagonalDPI ( ) const

Deprecated: use Display::getDPI() instead.

Returns
dpi

◆ getDPI()

float getDPI ( ) const

Returns the approximated display DPI: 96 * 'display content scale'

Returns
Approximated display DPI.

◆ getHorizontalDPI()

float getHorizontalDPI ( ) const

Deprecated: use Display::getDPI() instead.

Returns
dpi

◆ getIndex()

int getIndex ( ) const

Current display index, as given on construction. Note that his index becomes invalid when the display is re-connected.

Returns
display index as provided on construction

◆ getMax()

const glm::ivec2& getMax ( ) const
Returns
max location of desktop area of this display, with the primary display located at 0,0

◆ getMin()

const glm::ivec2& getMin ( ) const
Returns
min location of desktop area of this display, with the primary display located at 0,0

◆ getName()

const std::string& getName ( ) const

Returns display name, empty if not available.

Returns
display name, empty if not available.

◆ getOrientation()

EOrientation getOrientation ( ) const
Returns
display orientation

◆ getVerticalDPI()

float getVerticalDPI ( ) const

Deprecated: use Display::getDPI() instead.

Returns
dpi

◆ isValid()

bool isValid ( ) const

If information is available.

Returns
if information is available.

◆ operator!=()

bool operator!= ( const Display rhs) const
Returns
if two displays values are not the same based on hardware index

◆ operator==()

bool operator== ( const Display rhs) const
Returns
if two displays are the same based on hardware index.

◆ toString()

std::string toString ( ) const
Returns
display information as human readable string