Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved] 100% CPU - no matter what code I use.  (Read 5316 times)

0 Members and 1 Guest are viewing this topic.

  • Guest
[Solved] 100% CPU - no matter what code I use.
« 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!

hacky

  • Newbie
  • *
  • Posts: 26
    • View Profile
[Solved] 100% CPU - no matter what code I use.
« Reply #1 on: August 11, 2008, 09:32:38 am »
intel pentium 1
150 mhz?

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
[Solved] 100% CPU - no matter what code I use.
« Reply #2 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().

zarka

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
[Solved] 100% CPU - no matter what code I use.
« Reply #3 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)
//Zzzarka

  • Guest
[Solved] 100% CPU - no matter what code I use.
« Reply #4 on: August 11, 2008, 10:45:07 am »
SetFramerateLimit works perfectly, I think.

Thanks a bunch!

Kreeg

  • Full Member
  • ***
  • Posts: 115
    • View Profile
[Solved] 100% CPU - no matter what code I use.
« Reply #5 on: August 11, 2008, 12:49:38 pm »
Add the [Solved] tag to your thread's name.
Attention (va) aux (sur) messages (mon) subliminaux, (blog) camarade !

 

anything