| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- #pragma once
- #include "Defines.h"
- #include "Types.h"
- namespace gameplay
- {
- enum class MonitorChangeEvent : uint32_t
- {
- UNKNOWN,
- CONNECTED,
- DISCONNECTED
- };
- struct MonitorHandle;
- /**
- * Defines a monitor.
- */
- class GP_API Monitor
- {
- friend class App;
- friend class Window;
- public:
- struct VideoMode
- {
- int32_t width;
- int32_t height;
- int32_t redBits;
- int32_t greenBits;
- int32_t blueBits;
- int32_t refreshRate;
- };
- struct WorkArea
- {
- Int2 pos;
- Int2 size;
- };
- /**
- * Constructor.
- */
- Monitor();
- /**
- * Destructor.
- */
- ~Monitor();
- /**
- * Gets the name of the monitor.
- *
- * @return The name of the monitor.
- */
- const char* get_name() const;
- /**
- * Gets the video mode information.
- *
- * @return The video mode information.
- */
- VideoMode get_video_mode() const;
- /**
- * Gets the physical size, in millimetres, of the display area of the specified monitor.
- *
- * @return The physical size.
- */
- Int2 get_physical_size() const;
- /**
- * Gets the position of the monitor's viewport on the virtual screen.
- *
- * @return The position of the monitor's viewport.
- */
- Int2 get_pos() const;
- /**
- * Gets the content scale for the monitor.
- *
- * The content scale is the ratio between the current DPI and
- * the platform's default DPI. This is especially important for
- * text and any UI elements. If the pixel dimensions of your UI
- * scaled by this look appropriate on your machine then it should
- * appear at a reasonable size on other machines regardless of
- * their DPI and scaling settings. This relies on the system DPI
- * and scaling settings being somewhat correct.
- *
- * @return The content scale for the monitor.
- */
- Float2 get_content_scale() const;
- /**
- * Gets the position and size of the work area.
- *
- * The position, in screen coordinates, of the upper-left corner
- * of the work area of the specified monitor along with the
- * work area size in screen coordinates. The work area is defined
- * as the area of the monitor not occluded by the operating
- * system task bar where present. If no task bar exists then the
- * work area is the monitor resolution in screen coordinates.
- *
- * @return The work area.
- */
- WorkArea get_work_area() const;
- /**
- * Sets user pointer associated with this monitor.
- *
- * @param userPtr The user pointer to associate.
- */
- void set_user_ptr(void* userPtr);
- /**
- * Gets the user pointer associated with this monitor.
- *
- * @return The user pointer to associate.
- */
- void* get_user_ptr() const;
- std::unique_ptr<MonitorHandle> handle;
- };
- }
|