Simulating Mouse click

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Simulating Mouse click

Post by Imerion »

A bit of an odd question perhaps, but is there a way to simulate a mouse-click? So a piece of code can trigger the same effect as clicking the left mouse button does?

If I could do this, and automatically activate any KeyPress components that happen to be active, I could make my whole game touch-compatible with a single piece of code. ;)
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Simulating Mouse click

Post by Kjell »

Hi Imerion,

A touch input ( of the first touch ID ) is already treated as a left-mouse click .. so checking for left-mouse-button in a KeyPress should do the trick. But maybe you've already tried that and it didn't work for some reason?

K
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Re: Simulating Mouse click

Post by Imerion »

That is smart! But it doesn't seem to work, no. I'll try a few things (now that I know it should be possible) and return when I have some results. ;)
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Simulating Mouse click

Post by VilleK »

Are you talking about touch for Android or for Windows? Because I'm pretty sure the script "touch" functions are not yet implemented on Windows :). I've never had access to a Windows touch device to test on.
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Re: Simulating Mouse click

Post by Imerion »

Android, but it does work! I just needed to adjust a few things. ;)
Post Reply