I have problem with this. On my PC (W10, AMD RX 480) when resolution isn't in supported fullscreen modes and window is fullscreen then sf::Mouse::getPosition(window) return desktop values. If it's windowed it works normally.
For example, when is created window with parameters 1366 x 768 and fullscreen it doesn't work.
Supported video modes:
VideoMode: 1920 1080
VideoMode: 1680 1050
VideoMode: 1600 900
VideoMode: 1280 1024
VideoMode: 1280 720
VideoMode: 1024 768
VideoMode: 800 600
VideoMode: 720 400
VideoMode: 640 480
// Game.h
class Game
{
public:
sf::RenderWindow window;
};
// Game.cpp
Game::Game()
{
std::vector<sf::VideoMode> supportedVideoModes;
supportedVideoModes = sf::VideoMode::getFullscreenModes();
for (auto it : supportedVideoModes)
{
std::cout << "VideoMode: " << it.width << " " << it.height << std::endl;
}
window.create(sf::VideoMode(1366, 768), "SFML", true ? sf::Style::Fullscreen : sf::Style::Close);
}
Game::Update()
{
std::cout << sf::Mouse::getPosition(window).x << ", " << sf::Mouse::getPosition(window).y << std::endl;
}