SFML community forums

General => General discussions => Topic started by: on August 11, 2008, 08:33:08 am

Title: [Solved] 100% CPU - no matter what code I use.
Post by: on August 11, 2008, 08:33:08 am
Going through all the tutorials on the SFML website, every single one of them make the CPU spike to 100% when running. Why is this?

FYI: So does SDL!
Title: [Solved] 100% CPU - no matter what code I use.
Post by: hacky on August 11, 2008, 09:32:38 am
intel pentium 1
150 mhz?
Title: [Solved] 100% CPU - no matter what code I use.
Post by: Avency on August 11, 2008, 10:09:02 am
If you don't limit your CPU usage, it will try to execute as fast as possible.
Try sf::Window::SetFramerateLimit() or sf::Sleep().
Title: [Solved] 100% CPU - no matter what code I use.
Post by: zarka on August 11, 2008, 10:19:06 am
Code: [Select]

int main()
{
    while(1) { }
    return 0;
}


this code will also make your CPU spike at 100% (if you have a single core)
Title: [Solved] 100% CPU - no matter what code I use.
Post by: on August 11, 2008, 10:45:07 am
SetFramerateLimit works perfectly, I think.

Thanks a bunch!
Title: [Solved] 100% CPU - no matter what code I use.
Post by: Kreeg on August 11, 2008, 12:49:38 pm
Add the [Solved] tag to your thread's name.