Hallo world :]
I just started out with SFML. On my way I had a problem. I'm sure you can help me ;-)
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow App(sf::VideoMode(600,300),"test");
sf::Image Image;
Image.LoadFromFile("lol.JPG");
const sf::Input& Input = App.GetInput();
sf::Sprite Sprite(Image);
sf::Event Event;
while (App.IsOpened())
{
/*
while (App.GetEvent(Event))
{
if (Event.Type==sf::Event::Closed)
App.Close();
if ((Event.Type==sf::Event::KeyPressed) && (Event.Key.Code==sf::Key::D))
Sprite.Move(1.5,0);
}
*/
bool Rechts = Input.IsKeyDown(sf::Key::Right);
if(Rechts)
Sprite.Move(1.5,0);
App.Clear(sf::Color(231,32,111));
App.Draw(Sprite);
App.Display();
}
return 0;
}
I comiles and it runs but it doesn't do what I expact it to do.
It doesn't react if I prss the Right key.
How ever...when I also compile the comments ( between /* */) it works.
Why? IsKeyDown doesn't depend on GetEvent does it?
BorisDieKlinge