I have found my problem.
If I do this:
unsigned int VideoModesCount = sf::VideoMode::GetModesCount();
for (unsigned int i = 0; i < VideoModesCount; ++i)
{
sf::VideoMode Mode = sf::VideoMode::GetMode(i);
// Mode is a valid video mode
std::cout << "Mode " << Mode.Width << "-" << Mode.Height << "-" << Mode.BitsPerPixel << " is valid" << std::endl;
}
I get this in the console:
Mode 1280-1024-32 is valid
Mode 1280-960-32 is valid
Mode 1152-864-32 is valid
Mode 1024-768-32 is valid
Mode 960-600-32 is valid
Mode 960-540-32 is valid
Mode 840-525-32 is valid
Mode 832-624-32 is valid
Mode 800-600-32 is valid
Mode 800-512-32 is valid
Mode 720-450-32 is valid
Mode 680-384-32 is valid
Mode 640-512-32 is valid
Mode 640-480-32 is valid
Mode 576-432-32 is valid
Mode 512-384-32 is valid
Mode 416-312-32 is valid
Mode 400-300-32 is valid
Mode 320-240-32 is valid
But my monitor knows only up to 24 BitsPerPixel.
So I change my mode to 24 BitsPerPixel and the mode is not
valid and it switches with this in your code to the nearest mode:
void Window::Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const WindowSettings& Params)
{
// Check validity of video mode
if ((WindowStyle & Style::Fullscreen) && !Mode.IsValid())
{
std::cerr << "The requested video mode is not available, switching to a valid mode" << std::endl;
Mode = VideoMode::GetMode(0);
}
// Check validity of style
if ((WindowStyle & Style::Close) || (WindowStyle & Style::Resize))
WindowStyle |= Style::Titlebar;
// Destroy the previous window implementation
delete myWindow;
// Activate the global context
Context::GetGlobal().SetActive(true);
mySettings = Params;
Initialize(priv::WindowImpl::New(Mode, Title, WindowStyle, mySettings));
}
And this mode is on my computer 1280 - 1024 - 24.
Can I change somewhere the valid modes to 24 BitsPerPixel?