Nebula
Loading...
Searching...
No Matches
displaymode.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/types.h"
14
15//------------------------------------------------------------------------------
16namespace CoreGraphics
17{
19{
20public:
24 DisplayMode(uint x, uint y, SizeT w, SizeT h);
30 bool operator==(const DisplayMode& rhs) const;
32 bool operator!=(const DisplayMode& rhs) const;
34 void SetXPos(uint x);
36 uint GetXPos() const;
38 void SetYPos(uint y);
40 uint GetYPos() const;
42 void SetWidth(SizeT w);
44 SizeT GetWidth() const;
46 void SetHeight(SizeT h);
48 SizeT GetHeight() const;
54 void SetAspectRatio(float a);
56 float GetAspectRatio() const;
57
61 uint GetRefreshRate() const;
63 void SetContentScale(float s);
65 float GetContentScale() const;
66
67
68private:
69
78
79};
80
81//------------------------------------------------------------------------------
84inline
86 xPos(0),
87 yPos(0),
88 width(1024),
89 height(768),
90 refreshRate(60),
91 aspectRatio(4.0f / 3.0f),
92 contentScale(1.0f),
93 pixelFormat(PixelFormat::SRGBA8)
94{
95 // empty
96}
97
98//------------------------------------------------------------------------------
102inline
104 xPos(x),
105 yPos(y),
106 width(w),
107 height(h),
108 refreshRate(60),
109 aspectRatio(float(w) / float(h)),
110 contentScale(1.0f),
111 pixelFormat(PixelFormat::SRGBA8)
112{
113 // empty
114}
115
116//------------------------------------------------------------------------------
120inline
122 xPos(0),
123 yPos(0),
124 width(w),
125 height(h),
126 refreshRate(60),
127 aspectRatio(float(w) / float(h)),
128 contentScale(1.0f),
129 pixelFormat(p)
130{
131 // empty
132}
133
134//------------------------------------------------------------------------------
137inline
139 xPos(x),
140 yPos(y),
141 width(w),
142 height(h),
143 refreshRate(60),
144 aspectRatio(float(w) / float(h)),
145 contentScale(1.0f),
146 pixelFormat(p)
147{
148 // empty
149}
150
151//------------------------------------------------------------------------------
154inline bool
156{
157 return ((this->xPos == rhs.xPos) &&
158 (this->yPos == rhs.yPos) &&
159 (this->width == rhs.width) &&
160 (this->height == rhs.height) &&
161 (this->refreshRate == rhs.refreshRate) &&
162 (this->aspectRatio == rhs.aspectRatio) &&
163 (this->contentScale == rhs.contentScale) &&
164 (this->pixelFormat == rhs.pixelFormat));
165}
166
167//------------------------------------------------------------------------------
170inline bool
172{
173 return !(*this == rhs);
174}
175
176//------------------------------------------------------------------------------
179inline void
181{
182 this->xPos = x;
183}
184
185//------------------------------------------------------------------------------
188inline uint
190{
191 return this->xPos;
192}
193
194//------------------------------------------------------------------------------
197inline void
199{
200 this->yPos = y;
201}
202
203//------------------------------------------------------------------------------
206inline uint
208{
209 return this->yPos;
210}
211
212//------------------------------------------------------------------------------
215inline void
217{
218 this->width = w;
219}
220
221//------------------------------------------------------------------------------
224inline SizeT
226{
227 return this->width;
228}
229
230//------------------------------------------------------------------------------
233inline void
235{
236 this->height = h;
237}
238
239//------------------------------------------------------------------------------
242inline SizeT
244{
245 return this->height;
246}
247
248//------------------------------------------------------------------------------
251inline void
256
257//------------------------------------------------------------------------------
262{
263 return this->pixelFormat;
264}
265
266//------------------------------------------------------------------------------
269inline void
271{
272 this->aspectRatio = a;
273}
274
275//------------------------------------------------------------------------------
278inline float
280{
281 return this->aspectRatio;
282}
283
284//------------------------------------------------------------------------------
287inline void
289{
290 this->contentScale = a;
291}
292
293//------------------------------------------------------------------------------
296inline float
298{
299 return this->contentScale;
300}
301
302//------------------------------------------------------------------------------
305inline void
307{
308 this->refreshRate = refreshRate;
309}
310
311//------------------------------------------------------------------------------
314inline uint
316{
317 return this->refreshRate;
318}
319} // namespace CoreGraphics
320//------------------------------------------------------------------------------
321
322
Describe a fullscreen display mode or window dimensions.
Definition displaymode.h:19
float GetContentScale() const
get content scale factor
Definition displaymode.h:297
void SetAspectRatio(float a)
set aspect ratio
Definition displaymode.h:270
void SetPixelFormat(PixelFormat::Code p)
set pixel format
Definition displaymode.h:252
SizeT width
Definition displaymode.h:72
uint GetYPos() const
get y position
Definition displaymode.h:207
uint GetXPos() const
get x position
Definition displaymode.h:189
SizeT GetHeight() const
get height
Definition displaymode.h:243
void SetContentScale(float s)
set content scale factor
Definition displaymode.h:288
float GetAspectRatio() const
get aspect ratio
Definition displaymode.h:279
DisplayMode()
default constructor
Definition displaymode.h:85
void SetHeight(SizeT h)
set height
Definition displaymode.h:234
SizeT height
Definition displaymode.h:73
bool operator==(const DisplayMode &rhs) const
equality operator
Definition displaymode.h:155
float aspectRatio
Definition displaymode.h:75
SizeT GetWidth() const
get width
Definition displaymode.h:225
uint yPos
Definition displaymode.h:71
void SetXPos(uint x)
set x position
Definition displaymode.h:180
PixelFormat::Code GetPixelFormat() const
get pixel format
Definition displaymode.h:261
void SetRefreshRate(uint refreshRate)
using DirectX 11, the refresh rate exists within the display mode
Definition displaymode.h:306
uint xPos
Definition displaymode.h:70
PixelFormat::Code pixelFormat
Definition displaymode.h:77
uint refreshRate
Definition displaymode.h:74
bool operator!=(const DisplayMode &rhs) const
inequality operator
Definition displaymode.h:171
void SetYPos(uint y)
set y position
Definition displaymode.h:198
float contentScale
Definition displaymode.h:76
void SetWidth(SizeT w)
set width
Definition displaymode.h:216
uint GetRefreshRate() const
gives you the refresh rate
Definition displaymode.h:315
Pixel format enumeration.
Definition pixelformat.h:22
Code
enums
Definition pixelformat.h:26
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31