Exploiter, thank you for your rapid reply. The code I used is below:
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
int main()
{
// Create the main window
sf::RenderWindow app(sf::VideoMode(1920, 1080), "SFML window", sf::Style::Fullscreen);
//sf::RenderWindow app(sf::VideoMode(1920, 1080), "SFML window");
//app.setFramerateLimit(30);
// Load a sprite to display
sf::Texture texture;
if (!texture.loadFromFile("../../../assets/images/star.png")) return EXIT_FAILURE;
sf::Sprite sprite(texture);
sprite.setOrigin(sprite.getGlobalBounds().width / 2, sprite.getGlobalBounds().height / 2);
// Start the game loop
while (app.isOpen())
{
//sf::sleep(sf::milliseconds(100));
// Process events
sf::Event event;
while (app.pollEvent(event))
{
// Close window : exit
if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) app.close();
if (event.type == sf::Event::Closed) app.close();
}
// Clear screen
app.clear();
// Draw the sprite
sprite.setPosition(sf::Mouse::getPosition(app).x, sf::Mouse::getPosition(app).y);
app.draw(sprite);
// Update the window
app.display();
}
return EXIT_SUCCESS;
}
As you may see I tried sleep, framerates and a some odd solutions that had no ultimate effect.
Edit: As you can tell by my use of getGlobalBounds where I should have used getLocalBounds -- I'm comming back to tinker from a long break.
Edit2: Inserting sf::sleep(sf::seconds(0));
after app.display();
seems to prevent the supposed hang about half the time. It could be a clue!