1
0
Fork 0

Initial commit

This commit is contained in:
Henrik Hautakoski 2015-12-22 17:43:51 +01:00
commit edfc5298e1
252 changed files with 93965 additions and 0 deletions

View file

@ -0,0 +1,54 @@
#include <Spectre/Display/DisplayMode.h>
#include <Platform/PlatformMisc.h>
#include <algorithm>
struct DisplayModeCmp
{
inline bool operator() (const DisplayMode& a, const DisplayMode& b)
{
if (a.bpp == b.bpp) {
if (a.width == b.width) {
return a.height > b.height;
}
return a.width > b.width;
}
return a.bpp > b.bpp;
}
};
DisplayMode::DisplayMode() :
width (0),
height (0),
bpp (32)
{
}
DisplayMode::DisplayMode(unsigned int width, unsigned int height, unsigned int bpp) :
width (width),
height (height),
bpp (bpp)
{
}
std::vector<DisplayMode> DisplayMode::getFullscreenModes()
{
static std::vector<DisplayMode> modes;
if (modes.size() < 1) {
PlatformMisc::GetDisplayModes(modes);
// Sort.
std::sort(modes.begin(), modes.end(), DisplayModeCmp());
// remove duplicates
modes.erase(std::unique(modes.begin(), modes.end()), modes.end());
}
return modes;
}
DisplayMode DisplayMode::getDesktopMode()
{
return PlatformMisc::GetDesktopMode();
}