29 #if defined( CINDER_MAC )
30 #if defined( __OBJC__ )
35 typedef uint32_t CGDirectDisplayID;
36 #elif defined( CINDER_COCOA_TOUCH )
37 #if defined( __OBJC__ )
42 #elif defined( CINDER_MSW )
81 #if defined( CINDER_MAC )
82 NSScreen* getNsScreen()
const {
return mScreen; }
83 CGDirectDisplayID getCgDirectDisplayId()
const {
return mDirectDisplayID; }
84 #elif defined( CINDER_COCOA_TOUCH )
85 UIScreen* getUiScreen()
const {
return mUiScreen; }
87 const std::vector<Vec2i>& getSupportedResolutions()
const {
return mSupportedResolutions; }
89 void setResolution(
const Vec2i &resolution );
95 static const std::vector<DisplayRef>&
getDisplays();
101 #if defined( CINDER_MAC )
102 static DisplayRef findFromCgDirectDisplayId( CGDirectDisplayID displayID );
103 static DisplayRef findFromNsScreen( NSScreen *nsScreen );
104 #elif defined( CINDER_MSW )
105 static DisplayRef findFromHmonitor( HMONITOR hMonitor );
107 static BOOL CALLBACK enumMonitorProc( HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM lParam );
112 return o << display.mArea <<
" @ " << display.mBitsPerPixel <<
"bpp @ scale " << display.mContentScale;
115 #if defined( CINDER_COCOA_TOUCH )
116 signals::signal<void()>& getSignalDisplaysChanged() {
return mSignalDisplaysChanged; }
118 template<
typename T,
typename Y>
119 void connectDisplaysChanged( T fn, Y *inst ) { getSignalDisplaysChanged().connect( std::bind( fn, inst ) ); }
126 #if defined( CINDER_MAC )
128 CGDirectDisplayID mDirectDisplayID;
129 #elif defined( CINDER_COCOA_TOUCH )
131 std::vector<Vec2i> mSupportedResolutions;
132 signals::signal<void()> mSignalDisplaysChanged;
133 #elif defined( CINDER_MSW )
137 static void enumerateDisplays();
139 static std::vector<DisplayRef> sDisplays;
140 static bool sDisplaysInitialized;
friend std::ostream & operator<<(std::ostream &o, const Display &display)
Definition: Display.h:110
float getAspectRatio() const
Returns the Display aspect ratio, which is its width / height.
Definition: Display.h:66
float getContentScale() const
Returns the factor which multiplies points to pixels. 2.0f for high-density (Retina) displays; 1...
Definition: Display.h:76
static Area getSpanningArea()
Returns the Area which spans all Displays.
Definition: Display.cpp:72
static DisplayRef getMainDisplay()
Returns the system's primary display.
Definition: Display.cpp:302
bool contains(const Vec2i &offset) const
Definition: Area.cpp:112
static const std::vector< DisplayRef > & getDisplays()
Returns a vector of all displays connected to the system.
Definition: Display.cpp:54
Vec2i getSize() const
Returns the size of the Display measured in points.
Definition: Display.h:64
Vec2i getSystemCoordinate(const Vec2i &displayRelativeCoordinate) const
Returns the system position (relative to the system's primary display's upper-left corner) of a Displ...
Definition: Display.cpp:297
int getBitsPerPixel() const
Returns the bits per pixel for the display. Typically 24 bits.
Definition: Display.h:74
int32_t getWidth() const
Definition: Area.h:47
Area getBounds() const
Returns the bounding Area of the Display in points, measured relative to primary display's upper-left...
Definition: Display.h:68
std::shared_ptr< class Display > DisplayRef
Definition: Display.h:53
bool contains(const Vec2i &pt) const
Returns whether the Display's coordinates contain pt.
Definition: Display.h:79
int getHeight() const
Returns the height of the screen measured in points.
Definition: Display.h:62
int getWidth() const
Returns the width of the screen measured in points.
Definition: Display.h:60
~Display()
Definition: Display.cpp:45
int32_t getHeight() const
Definition: Area.h:48
static DisplayRef getDisplayForPoint(const Vec2i &pt)
Returns the Display which contains a given point, measured relative to the upper-left corner of the p...
Definition: Display.cpp:61
Vec2< int > Vec2i
Definition: Vector.h:1313