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

56 lines
1.2 KiB
C++

#ifndef XNA_GRAPHICS_DISPLAYMODE_HPP
#define XNA_GRAPHICS_DISPLAYMODE_HPP
#include "../default.hpp"
namespace xna {
struct DisplayModeDescription;
class DisplayMode {
public:
DisplayMode();
~DisplayMode();
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:
Int Width{ 0 };
Int Height{ 0 };
SurfaceFormat Format{ SurfaceFormat::Color };
public:
struct PlatformImplementation;
uptr<PlatformImplementation> impl;
};
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;
public:
std::vector<sptr<DisplayMode>> DisplayModes;
};
}
#endif