1
Window / Re: Detecting keypresses on Mac OSX Catalina
« on: January 23, 2023, 02:27:04 am »Arrow keys work just fine with events. Make sure your modifier detection code isn't consuming the event before it hits your other key event handling.
I can't see any way that that could be the case. My main loop is literally this (the parameter is passed by reference):
while(window.pollEvent(currentEvent)) handle_one_event(currentEvent);
And just to test if maybe you were right, I added this as the very first thing in handle_one_event, before my modifier detection code (which does swallow some key events):
if(event.type == sf::Event::KeyReleased) {
std::cout << "A key was released!\n";
}
std::cout << "A key was released!\n";
}
And I see the message if I press and release a modifier key, but not if I press and release any other key.
That said, I tried opening up a different project and it works in that project, so there must be something I'm doing somewhere that makes it stop working…
One thing to also keep in mind, since you used the words "chords", that many (cheap) keyboards can't handle more than 3-4 key presses at a time, usually depending on certain blocks of keys.
You'd need to have a keyboard n-key-rollover support, if you want to not have such a limitation.
That shouldn't be a problem, I'm only looking for 2 arrows at a time.