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

Author Topic: setFramerateLimit doesn't work  (Read 3450 times)

0 Members and 1 Guest are viewing this topic.

Ocordu

  • Newbie
  • *
  • Posts: 4
    • View Profile
setFramerateLimit doesn't work
« on: February 09, 2014, 06:52:00 pm »
My application uses a large amount of CPU regardless of if it's set or not.

#include <SFML/Graphics.hpp>

int main() {
    sf::RenderWindow game(sf::VideoMode(800, 450), "Survive++");
    game.setFramerateLimit(60);
    while (game.isOpen()) {
        sf::Event event;
        while (game.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                game.close();
            }
        }
    }
    return 0;
}
 
« Last Edit: February 09, 2014, 07:07:49 pm by Ocordu »

AlejandroCoria

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • alejandrocoria.games
    • Email
Re: setFramerateLimit doesn't work
« Reply #1 on: February 09, 2014, 07:11:03 pm »
you need to use
game.display();

Ocordu

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: setFramerateLimit doesn't work
« Reply #2 on: February 09, 2014, 07:49:40 pm »
you need to use
game.display();

Thanks  :)

AlejandroCoria

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • alejandrocoria.games
    • Email
Re: setFramerateLimit doesn't work
« Reply #3 on: February 09, 2014, 08:06:53 pm »