1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/inc/xna/graphics/displaymode.hpp

61 lines
1.5 KiB
C++
Raw Normal View History

2024-03-18 15:41:46 -03:00
#ifndef XNA_GRAPHICS_DISPLAYMODE_HPP
#define XNA_GRAPHICS_DISPLAYMODE_HPP
2024-04-21 19:55:50 -03:00
#include "../default.hpp"
2024-03-18 15:41:46 -03:00
namespace xna {
2024-04-21 19:55:50 -03:00
struct DisplayModeDescription;
2024-03-18 15:41:46 -03:00
//Describes the display mode.
2024-05-20 11:51:32 -03:00
class DisplayMode {
2024-03-18 15:41:46 -03:00
public:
DisplayMode();
2024-05-20 11:51:32 -03:00
//Gets the aspect ratio used by the graphics device.
2024-05-20 11:51:32 -03:00
constexpr float AspectRatio() const {
if (Height == 0 || Width == 0)
return 0;
return static_cast<float>(Width) / static_cast<float>(Height);
}
constexpr bool operator==(const DisplayMode& other) const {
return Width == other.Width
&& Height == other.Height
&& Format == other.Format;
}
public:
//Gets a value indicating the screen width, in pixels.
2024-05-20 11:51:32 -03:00
Int Width{ 0 };
//Gets a value indicating the screen height, in pixels.
2024-05-20 11:51:32 -03:00
Int Height{ 0 };
//Gets a value indicating the surface format of the display mode.
2024-05-20 11:51:32 -03:00
SurfaceFormat Format{ SurfaceFormat::Color };
public:
struct PlatformImplementation;
uptr<PlatformImplementation> impl;
};
//Manipulates a collection of DisplayMode structures.
2024-05-20 11:51:32 -03:00
class DisplayModeCollection {
public:
constexpr DisplayModeCollection() = default;
DisplayModeCollection(size_t count) : DisplayModes(count) {}
DisplayModeCollection(std::vector<sptr<DisplayMode>> const& displayModes) :
DisplayModes(displayModes) {}
size_t SurfaceCount(SurfaceFormat format) const;
std::vector<sptr<DisplayMode>> Query(SurfaceFormat format) const;
sptr<DisplayMode> Query(SurfaceFormat format, Uint width, Uint height) const;
2024-03-24 16:12:17 -03:00
public:
2024-05-20 11:51:32 -03:00
std::vector<sptr<DisplayMode>> DisplayModes;
2024-03-18 15:41:46 -03:00
};
}
#endif