// get the current mouse position in the window sf::Vector2i pixelPos = sf::Mouse::getPosition(window); // convert it to world coordinates sf::Vector2f worldPos = window.mapPixelToCoords(pixelPos);