4#ifndef GREM_GRAPHICS_DISPLAY_HPP
5#define GREM_GRAPHICS_DISPLAY_HPP
71 constexpr DisplayMode(uint32_t displayID, uint32_t format,
Extent2D size,
float pixelDensity,
float refreshRate,
int refreshRateNumerator,
int refreshRateDenominator,
72 void* internal) noexcept
73 : displayID(displayID)
76 , pixelDensity(pixelDensity)
77 , refreshRate(refreshRate)
78 , refreshRateNumerator(refreshRateNumerator)
79 , refreshRateDenominator(refreshRateDenominator)
80 , internal(internal) {}
87 int refreshRateNumerator;
88 int refreshRateDenominator;
237 [[nodiscard]] static constexpr
DisplayMode createDisplayMode(uint32_t displayID, uint32_t format,
Extent2D size,
float pixelDensity,
float refreshRate,
238 int refreshRateNumerator,
int refreshRateDenominator,
void* internal) noexcept {
239 return DisplayMode{displayID, format, size, pixelDensity, refreshRate, refreshRateNumerator, refreshRateDenominator, internal};
242 constexpr explicit Display(uint32_t displayID) noexcept
243 : displayID(displayID) {}
266 return display.displayID == 0;
281 display = Display{*p};
298 uint32_t* p =
nullptr;
324 return static_cast<size_type>(displayCount);
327 [[nodiscard]]
bool empty() const noexcept {
328 return displayCount == 0;
334 struct DisplayIDsDeleter {
335 GREM_API(
graphics)
void operator()(uint32_t* displayIDs)
const noexcept;
338 constexpr DisplayRange(uint32_t* displayIDs,
int displayCount) noexcept
339 : displayIDs(displayIDs)
340 , displayCount(displayCount) {}
365 return *p ==
nullptr;
391 DisplayMode displayMode = createDisplayMode(0, 0, {}, 0.0f, 0.0f, 0, 0,
nullptr);
408 return iterator{displayModes.get()};
416 return static_cast<size_type>(displayModeCount);
419 [[nodiscard]]
bool empty() const noexcept {
420 return displayModeCount == 0;
426 struct DisplayModesDeleter {
427 GREM_API(
graphics)
void operator()(
void** displayModes)
const noexcept;
430 constexpr DisplayModeRange(
void** displayModes,
int displayModeCount) noexcept
431 : displayModes(displayModes)
432 , displayModeCount(displayModeCount) {}
435 int displayModeCount;
#define GREM_ASSERT(expression)
Definition assertions.hpp:77
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Generic nullable RAII resource handle with exclusive ownership of a resource that is automatically de...
Definition UniqueHandle.hpp:26
Information about a specific display mode available to a Display.
Definition Display.hpp:26
Extent2D getSize() const noexcept
Get the size of the display mode.
Definition Display.hpp:34
float getPixelDensity() const noexcept
Get the pixel density of the display mode.
Definition Display.hpp:45
int getBitsPerPixel() const noexcept
Get the color depth of the display mode.
float getRefreshRate() const noexcept
Get the refresh rate of the display mode.
Definition Display.hpp:55
Definition Display.hpp:250
bool operator==(sentinel) const
Definition Display.hpp:265
Display value_type
Definition Display.hpp:253
const value_type * pointer
Definition Display.hpp:255
DisplayIterator operator++(int)
Definition Display.hpp:285
std::forward_iterator_tag iterator_category
Definition Display.hpp:256
DisplayIterator() noexcept=default
ptrdiff_t difference_type
Definition Display.hpp:252
const value_type & reference
Definition Display.hpp:254
DisplayIterator & operator++()
Definition Display.hpp:278
pointer operator->() const
Definition Display.hpp:274
reference operator*() const
Definition Display.hpp:269
DisplaySentinel sentinel
Definition Display.hpp:257
Definition Display.hpp:348
pointer operator->() const
Definition Display.hpp:373
DisplayModeIterator & operator++()
DisplayModeSentinel sentinel
Definition Display.hpp:355
std::forward_iterator_tag iterator_category
Definition Display.hpp:354
DisplayMode value_type
Definition Display.hpp:351
const value_type * pointer
Definition Display.hpp:353
DisplayModeIterator operator++(int)
Definition Display.hpp:379
ptrdiff_t difference_type
Definition Display.hpp:350
DisplayModeIterator() noexcept=default
bool operator==(sentinel) const
Definition Display.hpp:363
const value_type & reference
Definition Display.hpp:352
reference operator*() const
Definition Display.hpp:368
Definition Display.hpp:394
bool empty() const noexcept
Definition Display.hpp:419
pointer const_pointer
Definition Display.hpp:402
DisplayModeSentinel sentinel
Definition Display.hpp:405
DisplayMode value_type
Definition Display.hpp:396
reference const_reference
Definition Display.hpp:400
DisplayModeIterator::reference reference
Definition Display.hpp:399
size_t size_type
Definition Display.hpp:397
DisplayModeIterator iterator
Definition Display.hpp:403
iterator const_iterator
Definition Display.hpp:404
size_type size() const noexcept
Definition Display.hpp:415
sentinel end() const noexcept
Definition Display.hpp:411
iterator begin() const noexcept
Definition Display.hpp:407
DisplayModeIterator::difference_type difference_type
Definition Display.hpp:398
Definition Display.hpp:302
DisplaySentinel sentinel
Definition Display.hpp:313
size_type size() const noexcept
Definition Display.hpp:323
DisplayIterator::reference reference
Definition Display.hpp:307
iterator begin() const noexcept
Definition Display.hpp:315
size_t size_type
Definition Display.hpp:305
bool empty() const noexcept
Definition Display.hpp:327
sentinel end() const noexcept
Definition Display.hpp:319
Display value_type
Definition Display.hpp:304
pointer const_pointer
Definition Display.hpp:310
iterator const_iterator
Definition Display.hpp:312
DisplayIterator iterator
Definition Display.hpp:311
DisplayIterator::difference_type difference_type
Definition Display.hpp:306
reference const_reference
Definition Display.hpp:308
Information about a display on the host system.
Definition Display.hpp:95
DisplayModeRange getAvailableFullscreenDisplayModes() const
Get a list of all available fulscreen display modes for this display.
CStringView getName() const
Get the manufacturer-specified name of the display.
DisplayMode getDesktopDisplayMode() const
Get the display mode of the full desktop.
uint32_t getID() const noexcept
Get the unique identifier of this display.
float getContentScale() const
Get the expected scale for content based on the DPI settings of the display.
Region2D getBounds() const
Get the bounds of the display region on the desktop.
static Display getPrimary()
Get the current primary display.
static Optional< Display > findByID(uint32_t id)
Get the display with a specific identifier.
DisplayMode getDisplayMode() const
Get the current display mode of this display.
Orientation
Definition Display.hpp:105
@ LANDSCAPE
Landscape mode, rotated counter-clockwise relative to portrait mode.
Definition Display.hpp:107
@ UNKNOWN
Unknown display orientation.
Definition Display.hpp:106
@ PORTRAIT
Portrait mode.
Definition Display.hpp:109
@ LANDSCAPE_FLIPPED
Landscape mode, rotated clockwise relative to portrait mode.
Definition Display.hpp:108
@ PORTRAIT_FLIPPED
Portrait mode, upside down.
Definition Display.hpp:110
Orientation getOrientation() const noexcept
Get the current orientation of the display.
static DisplayRange getAll()
Get a list of all available displays.
Region2D getUsableBounds() const
Get the bounds of the usable display region on the desktop, which may exclude areas reserved by the s...
Graphical window that can be rendered to.
Definition Window.hpp:131
Definition concepts.hpp:106
Definition buffer_layouts.hpp:20
Extent< 2 > Extent2D
Size of a 2D data region.
Definition extents.hpp:31
Region< 2 > Region2D
Rectangular region of 2D data.
Definition extents.hpp:819
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635
Definition Display.hpp:346
Definition Display.hpp:248