SFML community forums

Help => General => Topic started by: sggocu88 on February 15, 2017, 07:05:22 pm

Title: High CPU usage if window.clear() and window.display() are not in the main loop
Post by: sggocu88 on February 15, 2017, 07:05:22 pm
Hi. If i don't put window.clear() and window.display() inside the main loop my game have 40-50 cpu usage. If i put them, my game have 1-2 cpu usage.
Why ? Or it's a problem with my pc ?
Sry for bad english
Title: Re: High CPU usage if window.clear() and window.display() are not in the main loop
Post by: Laurent on February 16, 2017, 06:35:11 am
window.display() will sleep (pause) if vertical sync is enabled by your graphics driver (or your code). If your main loop makes no pause, your app will consume as much CPU as it can, which means 50% on a dual core CPU.

PS: that's just a guess since you give almost no information