How to determine if target has Touch/Mouse/Controller/Keyboard

About Monkey 2 Forums Monkey 2 Programming Help How to determine if target has Touch/Mouse/Controller/Keyboard

This topic contains 2 replies, has 2 voices, and was last updated by  Diffrenzy 1 year, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8163

    Diffrenzy
    Keymaster

    How do I query the input capabilities of my target?

    I’m making an app that will run on iOS, Android, Android TV (controller input ) and Desktop.

    #8166

    Mark Sibly
    Keymaster

    Currently, you’ll need to use #If __TARGET__=”ios” etc. __TARGET__ is one of: “window”, “macos”, “linux”, “emscripten”, “android” or “ios”

    There’s also __DESKTOP_TARGET__, __MOBILE_TARGET__  and __WEB_TARGET__ booleans, eg:

    #If __DESKTOP_TARGET__  ‘windows, macos or linux

    #Elseif __MOBILE_TARGET__   ‘android or ios

    #Elseif __WEB_TARGET__   ’emscripten or wasm

    #Else

    #Print “IMPOSSIBLE!”

    #Endif

    This doesn’t allow for everything yet, eg: you can’t tell if a __WEB_TARGET__ has touch input (although you could set a flag if you detect any tough events) or if keyboard/mouse etc are unplugged.

    #8172

    Diffrenzy
    Keymaster

    Thanks,that will get me most of the way, but:

    I’d like to be able to tell the Android TV from the Android phone, and Chromebook, NumberOfJoysticks() will get me some of the way, but I guess there could be a phone with a Keyboard and Joystick attached, where you still want to use the touchscreen input.

    I’d like it to run on Chromebooks, with their upcomming ability to run Android apps, so some sort of function to determine “current platform” query is needed.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.