custom icon for mouse and no icon for touch [Solved]

0 favourites
  • 4 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi there,

    I'm making an app for kids that has a custom mouse graphic. this works fine with a windows 8 machine with a mouse.. but the trouble i run into is figuring out a good way to hide the mouse in all the layouts.

    I would like the app to show the custom mouse when the mouse is in use and when touch is in use hide the mouse custom icon..

    i've tried a couple of things and it just doesn't seem to be working.. I just can't seem to find a good logical system that can detect if the user is using a mouse and clicking things or touching things.

    There must be some efficient / straight forward way to allow a mouse to be hidden if touch is used..

    otherwise what i end up with is this static mouse that appears wherever i touch..

    Thanks!

    Caleb

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How about giving your custom graphic a couple of instance variables (ivOldX and ivOldY ?) then every x seconds compare the mouse position with these - if the mouse is still at its old position then just update the instance variable with the new positions otherwise "fade the mouse to invisible"...

  • yea i haven't tried that approach. i'll give it a shot. sounds like it could work. kind of like an auto hide feature. I'll give that a shot!

    Thanks!

    Caleb

  • Ok so this is what I ended up doing and it seems to work well.

    Because i have a custom mouse that tracks the mouse position it was difficult to dock the mouse because i didn't know how to directly tell the Mouse.X and Mouse.Y to move since I think this is outside of C2 control (the actual MOUSE indicates where the Mouse.X and Y are)

    So I made a variable MouseX and MouseY which the custom cursor would slave to instead of directly to the Mouse.X and Mouse.Y although the MouseX and Y are themselves constantly being updated by the Mouse.X and Mouse.Y make sense?

    Now for the real magic..

    I made an event that was saying "Touch is in Touch" + Left Mouse Button is down (inverted)

    This was set to destroy the mouse icon and also set a global var "MouseExists" which was set to 1 by default and set to 0 when the mouse was destroyed.

    then another event

    Mouse On any click + MouseExists = 0 this is set to create a new CustomMouse object.

    Seems to work nicely..

    so basically any touch event on the screen will kill the mouse and to get the mouse to return, any mouse click will create a new Mouse Cursor

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