Can love2D detect keypresses when unfocused?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Can love2D detect keypresses when unfocused?
I would like to press a key and have my love2D program respond without me first focusing the love2D window by clicking it. Would be useful for, say, a livestream visual that I can alter with a key press.
- BrotSagtMist
- Party member
- Posts: 613
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Can love2D detect keypresses when unfocused?
Doesnt look like it.
If youre the only user a quick hack in would be to just read from /dev/input in a thread.
I am not aware of other simple ways, let alone one that universally works.
If youre the only user a quick hack in would be to just read from /dev/input in a thread.
I am not aware of other simple ways, let alone one that universally works.
obey
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Can love2D detect keypresses when unfocused?
While keyboard and mouse won't really work like that, you can try whether gamepad input works when unfocused, that has a higher chance i think.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Can love2D detect keypresses when unfocused?
There's always the option to poll the keyboard through FFI, but that's OS-specific. For example, on Windows you can import and call GetAsyncKeyState to query the state of a key.
Who is online
Users browsing this forum: Amazon [Bot], Google [Bot] and 86 guests