SFML community forums
Help => General => Topic started by: rogeriodec on May 23, 2018, 01:32:24 am
-
Why a single code like this can consume about 15% of CPU usage in a Intel I7 processor?
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
RenderWindow window(VideoMode(800, 600), "Janela", Style::Close);
window.setFramerateLimit(120);
while (window.isOpen())
{
for (Event event; window.pollEvent(event);) {
if (event.type == Event::Closed)
window.close();
}
}
return EXIT_SUCCESS;
}
-
setFramerateLimit has no effect if you never call window.display().
-
Perfect.
Thank you very much!