Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - BananaBroSHSID

Pages: [1]
1
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 << &#39;e&#39; << 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.

Pages: [1]