// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Engine - Utility module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #if defined(NAZARA_PLATFORM_WINDOWS) #include #elif defined(NAZARA_PLATFORM_X11) #include #else #error Lack of implementation: Window #endif #include namespace Nz { VideoMode::VideoMode() : bitsPerPixel(0), height(0), width(0) { } VideoMode::VideoMode(unsigned int w, unsigned int h, UInt8 bpp) : bitsPerPixel(bpp), height(h), width(w) { } bool VideoMode::IsFullscreenValid() const { const std::vector& modes = GetFullscreenModes(); return std::binary_search(modes.begin(), modes.end(), *this, std::greater()); } VideoMode VideoMode::GetDesktopMode() { return VideoModeImpl::GetDesktopMode(); } const std::vector& VideoMode::GetFullscreenModes() { static std::vector modes; if (modes.empty()) { VideoModeImpl::GetFullscreenModes(modes); std::sort(modes.begin(), modes.end(), std::greater()); } return modes; } bool operator==(const VideoMode& left, const VideoMode& right) { return left.width == right.width && left.height == right.height && left.bitsPerPixel == right.bitsPerPixel; } bool operator!=(const VideoMode& left, const VideoMode& right) { return left.width != right.width || left.height != right.height || left.bitsPerPixel != right.bitsPerPixel; } bool operator<(const VideoMode& left, const VideoMode& right) { if (left.bitsPerPixel == right.bitsPerPixel) { if (left.width == right.width) return left.height < right.height; else return left.width < right.width; } else return left.bitsPerPixel < right.bitsPerPixel; } bool operator<=(const VideoMode& left, const VideoMode& right) { if (left.bitsPerPixel == right.bitsPerPixel) { if (left.width == right.width) return left.height <= right.height; else return left.width < right.width; } else return left.bitsPerPixel < right.bitsPerPixel; } bool operator>(const VideoMode& left, const VideoMode& right) { return right < left; } bool operator>=(const VideoMode& left, const VideoMode& right) { return right <= left; } }