3
« on: March 12, 2011, 08:52:00 pm »
Hi.
I have some problems with input, when I try to rotate the square it stops for like 0.1 sec right after I press the key, and then it continue the rotation.
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow Game(sf::VideoMode(640, 480, 32), "Rotate");
Game.SetFramerateLimit(64);
sf::Shape Firkant;
Firkant.AddPoint(300, 300);
Firkant.AddPoint(400, 300);
Firkant.AddPoint(400, 400);
Firkant.AddPoint(300, 400);
Firkant.SetCenter(350.0f,350.0f);
Firkant.Move(300.0f, 200.0f);
const sf::Input& Input = Game.GetInput();
while(Game.IsOpened())
{
sf::Event Event;
while(Game.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
Game.Close();
if (Input.IsKeyDown(sf::Key::Down))
Firkant.Rotate(10);
}
Game.Clear();
Game.Draw(Firkant);
Game.Display();
}
return EXIT_SUCCESS;
}