How to know keyboard or no keyboard auto?

I am planning on using Macroquad for a game and certainly will have with keyboard an app but I would have to distinguish somehow if it has keyboard or not if I use all I can and I would like to not need runtime input like user please use your keyboard every time, is there a way to automatically do this? I know target android or ios for no keyboard but what about iPadOS? From what I got from zzzcode.ai iPadOS is grouped in with macos target and MacOS is one with a keyboard as are Windows and Linux, does like a crate work for this? Just whether there is or is not a keyboard so I can show some visual controls would be great, is there a definitive way? Also, I hear Android runs on computers now so how to distinguish phone or tablet from computer? Those cfg and # things help but are not exact as needed, am I missing something?

As far as I know, there is no general way to detect whether a keyboard is present other than detecting typing events. Platforms may or may not have this information available in some form, but nobody's written a portable library to detect it that I've heard of.

Not only that, there may technically be a keyboard device attached but not one the user currently wants to use, like a "convertible" laptop being used as a tablet.

Touchscreen-oriented platforms generally have an API to pop up the on-screen keyboard on demand, and this will notice whether a physical keyboard is attached and skip the on-screen one. But that is for text input, not game controls.

Most games I have seen rely on detecting which kind of input the user is providing and switching the UI based on that. It helps to have a "Press A to start" interaction even if you don't have any more menus than that.

:wink: Thanks, you are helpful everywhere, and I guess I just build for with keyboard 1 and without 1 maybe or maybe not, maybe. I guess asking how to do it on each platform or a platform specific thing for each is too much, right?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.