How do I change "Use mouse input" programatically ?

Get help using Construct 2

Post » Mon Oct 06, 2014 4:14 pm

Hi guys !

That's pretty much it...I need to change the TOUCH object property "User mouse input" from NO to YES and backwards programatically.

I've search around pretty much but didn't find an answer.

Can you help a newbie ?

Thanks alot !
B
9
S
1
Posts: 22
Reputation: 946

Post » Mon Oct 06, 2014 4:34 pm

There's probably a good reason why you'd want to do this, but I can't think of any..

Guess the only real solution would be putting the touch events and mouse events in different groups and enabling/disabling them..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 06, 2014 4:59 pm

Maybe there is a reason ... dunno..!

The reason I need this functionality is because I have to position an object in the screen on a certain position. Mouse.X and Mouse.Y are only detected for mouse clicks and Touch.X and Touch.Y for touch inputs so I need to find out at the initial layout if the user is using the mouse or touch and therefore specify the object position on screen to br retrieved from mouse or touch coordinates.

Touch.X and Touch.Y should give the same coordinates that Mouse.X and if the Touch property of use mouse is enabled....
Last edited by kinetic on Mon Oct 06, 2014 5:18 pm, edited 1 time in total.
B
9
S
1
Posts: 22
Reputation: 946

Post » Mon Oct 06, 2014 5:01 pm

If you are using mouse input on touch ( so set to yes) you can always just use touch.x,touch.y..

touch - coordinates are only registered while touching (so in the case of the mouse while left mouse button is down)
otherwise they return 0
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 06, 2014 5:23 pm

LittleStain.. I was writing at the same time you were..
Well thats the issue, my project isnt beahving like that. When I use the Touch.X and Touch.Y and place the object x and y coordinates at those positions the object appears in the top left corner ... like it is deteting my mouse coordinates at 0,0 . (Im using the mouse but intend this to work on a tablet).

Or Im doing something wrong or there is a bug in r178.
B
9
S
1
Posts: 22
Reputation: 946

Post » Mon Oct 06, 2014 5:29 pm

If you aren't touching the screen, so also when the mouse left button isn't down touch.x will be 0 and touch.y will be 0..

mouse.x is the place the mouse cursor is (so even when there is no other input) touch doesn't have a cursor, so no value if there is no touch..
To simulate touch with the mouse the left mouse button should be down..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 06, 2014 6:04 pm

I see what you mean...

I am using a combination of:

If object A is overlaping object B and "Touch Is not touching A" (used an invert here) then position C at touch.X and touch.Y.

Basically what I'm doing is draging an object to a target and releasing the mouse. If it's over the target then get the position where the mouse pointer was released.....but this with touch events.

Anyway I might be doing something wrong here...dunno if inverting "Is Touching" works like not touching .. or releasing finger...
B
9
S
1
Posts: 22
Reputation: 946

Post » Mon Oct 06, 2014 6:08 pm

Sounds like you should be using the DragDrop behaviour, rather than manually doing it.
ImageImageImage
B
71
S
21
G
231
Posts: 3,691
Reputation: 129,358

Post » Mon Oct 06, 2014 6:31 pm

Yes you are absolutly right Blackhornet..

As a matter of fact I am using DragDrop behaviour but for some reason I made it harder then simplifying. I think its working as I havn't tested in a touch device..

Thanks guys for your great help as always !
B
9
S
1
Posts: 22
Reputation: 946


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 60 guests