Hello everyone,
when i run this project my cpu usage is at 25%. Normally i think should be around 5%!
I had the same problem a few weeks ago and you helped me to fix it. There it was something with the joystick update.
It cant be the same problem because i commented out the line in the sfml code and recompiled it.
Here is the code:
#include <SFML/Graphics.hpp>
void main()
{
sf::RenderWindow App(sf::VideoMode(1280, 720, 32), "Test");
sf::Sprite SPlayer;
sf::Texture TPlayer;
sf::Clock clock;
sf::Time ElapsedTime;
TPlayer.loadFromFile("tank1.png");
SPlayer.setTexture(TPlayer);
App.setVerticalSyncEnabled(true);
while(App.isOpen())
{
sf::Event Event;
while(App.pollEvent(Event))
{
if(Event.type == sf::Event::Closed)
App.close();
}
ElapsedTime = clock.restart();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
SPlayer.move(-50 * ElapsedTime.asSeconds(), 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
SPlayer.move(50 * ElapsedTime.asSeconds(), 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
{
SPlayer.move(0, -50 * ElapsedTime.asSeconds());
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
{
SPlayer.move(0, 50 * ElapsedTime.asSeconds());
}
App.clear();
App.draw(SPlayer);
App.display();
}
}
And here is an image of the output from very sleepy:
http://imgur.com/T8vWeMy Pc:
Intel Core i5 2500k
gtx 560 ti
Im using sfml 2.0. Its the build i have recompiled to fix the old problem.
Hope someone can help me