baton icon indicating copy to clipboard operation
baton copied to clipboard

Add support for systems without mouse or keyboard

Open Nawias opened this issue 3 years ago • 5 comments

Added nullchecks for love.keyboard and love.mouse for forks of LOVE like LOVEPotion, where keyboard and mouse aren't handled like normal

Nawias avatar Nov 18 '22 15:11 Nawias

Arguably, if love.keyboard and love.mouse aren't available, shouldn't we throw an error if somebody tries to use those sources instead of silently doing nothing? Unless you're trying to use the same code for multiple platforms.

tesselode avatar Nov 24 '22 21:11 tesselode

Yeah, that's what I'm trying to do

Nawias avatar Nov 25 '22 07:11 Nawias

I'd like to add, baton works well with lovepotion (after this nilcheck) and if my changes don't slow down the library significantly, I feel it would be a better option to have it merged rather than maintain a fork for just this purpose

Nawias avatar Nov 25 '22 19:11 Nawias

My concern isn't the performance, it's the silent misbehavior. Does LovePotion offer any way to tell that you're running on 3DS at runtime? Because if so, I would just use a different input config depending on the system.

tesselode avatar Nov 25 '22 23:11 tesselode

I mean, there are some constants that tell you what console you're running on, but I don't know if "misbehaviour" is the right word. Lovepotion runs only on 3DS and Switch, none of which have a concept of mouse and keyboard, so the love.mouse and love.keyboard APIs were not fully implemented by the developer (love.keyboard is used for the system keyboard like in smartphones, I believe). So what my nilchecks do is just keep the library from crashing on those consoles, because it would just throw a lua error trying to access a method that is nil.

Nawias avatar Nov 26 '22 07:11 Nawias