As the title states, Keyboard::isKeyPressed is not working. To demonstrate this issue, I created a simple project to show that it does not work:
#include <iostream>
#include "SFML/Graphics.hpp"
#include "SFML/Window.hpp"
using namespace std;
using namespace sf;
RenderWindow window(VideoMode(1400, 840), "Game Window");
int main(){
while(window.isOpen()){
Event event;
if(Keyboard::isKeyPressed(Keyboard::A)){
cout << 'e' << endl;
}
while (window.pollEvent(event)){
if (event.type == Event::Closed){
window.close();
}
}
}
}
Even if I pressed A, nothing gets outputted.
Some additional information, I code in XCode on Mac; however, I can't run SFML directly from XCode. Instead, I downloaded SFML through homebrew and ran the code through Terminal. I don't know if this affects the code (it didn't affect it previously) but I figured I might add it.