Detect mobile/tablet by detecting lack of mouse?

0 favourites
  • 5 posts
From the Asset Store
a ready made template of Mobile Advert, Google Play and Mobile IAP Plugin,
  • Sorry for not looking into this myself before posting but just thought of this, not around Construct to test it, and will probably forget it soon:

    What will Mouse.X/Mouse.Y result in on devices without a mouse?

    Thinking along the lines of:

    -On Layout Start

    --If Mouse.X =! (???) then (set conditions for desktop)

    Thought this might be an easy way to detect without needing any input from user...

  • if you add both the mouse object and the touch object it'll return 0 (if the touch object isn't there it seems that touching the screen will make the last position of the touch the mouse coordinate at least on opera mobile), however it will also return 0 on desktop if the mouse is outside the game window at start it seems, so it is not that reliable

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There's a system condition that will tell you if the game is being run on a mobile device or not. Look in the manual for more details about it.

  • There's a system condition that will tell you if the game is being run on a mobile device or not. Look in the manual for more details about it.

    Is it fairly accurate?

    I know its never perfect and a challenge to update with new systems—I remember when iphone ruined CSS media queries by marking themselves as not a mobile

  • I don't use mobile but the manual entry lists iPhone being registered as such as I recall when I read it initially. I suppose it's possible for the browser to lie about what it is.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)