SFML community forums

Help => Window => Topic started by: Aridjar on July 22, 2014, 05:06:16 pm

Title: Key pressur don't return anithing 2.1
Post by: Aridjar on July 22, 2014, 05:06:16 pm
Hey.

It's my first topic, so you'll probably ask me more details, but i can't put all the code cause it's on an other computer.

So, here the thing : I need tu use the Return and Escape key of my keyboard. But, with the following code :

while (window.isOpen())
{
while(window.pollEvent(event))
if (event.type == sf::Event::KeyPressed)
std::cout << _event.key.code << std::endl;
}
 
Title: Re: Key pressur don't return anithing 2.1
Post by: Nexus on July 22, 2014, 05:30:59 pm
It's my first topic, so you'll probably ask me more details
You guessed correctly :P
You should read this thread (http://en.sfml-dev.org/forums/index.php?topic=5559.0). Please take the time and read it carefully, it will save you and us time with useless questions :)

but i can't put all the code cause it's on an other computer.
You're not supposed to post all the code, a minimal complete example as explained in the link is ideal.

Most importantly, describe the problem.
Title: Re: Key pressur don't return anithing 2.1
Post by: Stauricus on July 22, 2014, 05:42:16 pm
you seem to be using two different sf::Event objects, "event" and "_event".
if changing that doesn't fix the problem, then i have no idea. even your topic doesn't seems to be finished :P