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

Get help using Construct 2

Post » Wed Apr 09, 2014 6:08 am

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
Last edited by part12studios on Wed Apr 09, 2014 8:18 pm, edited 1 time in total.
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Wed Apr 09, 2014 7:00 am

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"...
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Wed Apr 09, 2014 3:16 pm

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
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Wed Apr 09, 2014 8:17 pm

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
B
59
S
9
G
1
Posts: 942
Reputation: 6,553


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Exabot [Bot] and 29 guests