As anyone who needs to use the keyboard will know, there are 2 methods for grabbing keyboard input in SFML.
if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
and
if((Event.type == sf::Event::KeyPressed) && (Event.key.code == sf::Keyboard::A))
The first of which is true whenever the A key is held down, and ALWAYS when the A key is held down, wether the window is active or not.
The second, is a more classic "Key pressed" function, and returns true the moment A is initially pressed (and repeats if held due to OS key auto-repeat when held funtion), but since this is checked against an event returned by sf::Window::pollEvent(sf::Event) is only true if the window is currently active when the key is pressed.
I had a look at the sf::Window class to see if there was a function return to check if the window was currently active or not, but couldn't see anything...
Does anyone have a solution (Looking for something to add to the if() statement here) to make my first if check true ONLY when the window is currently active?
I was looking to do something along the lines of
if(window.isActive() && sf::Keyboard::isKeyPressed(sf::Keyboard::A))
but as mentioned, the aparant lack of an isActive() function on sf::Window makes that difficult.