Hi!
Can someone shed some light on how a game would behave when
window.setFramerateLimit is not set?
I was running a very simple game and I accidentally commented out the line in which I was setting the framerate limit, and when I run it it appeared to be stuck. The first time it froze my entire screen (I had to Ctrl-Alt-F2, find the process and kill it. I'm on linux). The second time, the window appeared but that was frozen (the rest of my applications was not). The third time I run it, I didn't even see the window.
My program is something along these lines
RenderWindow window{{windowWidth, windowHeight}, "Title"};
// window.setFramerateLimit(120);
while(true){
window.clear(Color::Black);
Event event;
int eventPerFrame {0};
while(window.pollEvent(event)){
if (event.type == Event::Closed) {
window.close();
break;
}
}
if(Keyboard::isKeyPressed(Keyboard::Key::Escape)) break;
// update logic here
window.display();
}
Also, if I put some logging in the game loop, I don't see anything. It seems that it gets stuck at the event polling.
I'd like to understand if setFramerateLimit is mandatory and why apparently without that my program gets stuck at the polling.
[It's my first post here. Please let me know if I missed some rule of the etiquette or if I should do something differently].
Thank you!