|
@@ -1,34 +1,35 @@
|
|
|
#include "Input.h"
|
|
#include "Input.h"
|
|
|
|
|
+#include "sfwindow.h"
|
|
|
#include <SFML/Window/Keyboard.hpp>
|
|
#include <SFML/Window/Keyboard.hpp>
|
|
|
|
|
|
|
|
#define INPUT WalrusRPG::Input
|
|
#define INPUT WalrusRPG::Input
|
|
|
|
|
|
|
|
bool INPUT::key_a()
|
|
bool INPUT::key_a()
|
|
|
{
|
|
{
|
|
|
- return sf::Keyboard::isKeyPressed(sf::Keyboard::Return);
|
|
|
|
|
|
|
+ return window.hasFocus() && sf::Keyboard::isKeyPressed(sf::Keyboard::Return);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool INPUT::key_b()
|
|
bool INPUT::key_b()
|
|
|
{
|
|
{
|
|
|
- return sf::Keyboard::isKeyPressed(sf::Keyboard::BackSpace);
|
|
|
|
|
|
|
+ return window.hasFocus() && sf::Keyboard::isKeyPressed(sf::Keyboard::BackSpace);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool INPUT::key_up()
|
|
bool INPUT::key_up()
|
|
|
{
|
|
{
|
|
|
- return sf::Keyboard::isKeyPressed(sf::Keyboard::W);
|
|
|
|
|
|
|
+ return window.hasFocus() && sf::Keyboard::isKeyPressed(sf::Keyboard::W);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool INPUT::key_down()
|
|
bool INPUT::key_down()
|
|
|
{
|
|
{
|
|
|
- return sf::Keyboard::isKeyPressed(sf::Keyboard::S);
|
|
|
|
|
|
|
+ return window.hasFocus() && sf::Keyboard::isKeyPressed(sf::Keyboard::S);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool INPUT::key_left()
|
|
bool INPUT::key_left()
|
|
|
{
|
|
{
|
|
|
- return sf::Keyboard::isKeyPressed(sf::Keyboard::A);
|
|
|
|
|
|
|
+ return window.hasFocus() && sf::Keyboard::isKeyPressed(sf::Keyboard::A);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool INPUT::key_right()
|
|
bool INPUT::key_right()
|
|
|
{
|
|
{
|
|
|
- return sf::Keyboard::isKeyPressed(sf::Keyboard::D);
|
|
|
|
|
|
|
+ return window.hasFocus() && sf::Keyboard::isKeyPressed(sf::Keyboard::D);
|
|
|
}
|
|
}
|