In fact, I would like to emulate a mouseClick each time a TuioCursor (touch point on multitouch table) enters my scene..
The TuioCursors events are handled this way ;
public void addTuioCursor(TuioCursor tuioCursor)
public void updateTuioCursor(TuioCursor tuioCursor)
public void removeTuioCursor(TuioCursor tuioCursor)
add is when a new touch point is added.
update is when a cursor is updated (has moved).
remove is when a cursor is removed.
In each of these events, here are the infos I can get from the TuioCursorparameter :
X
Y
SessionID : a sessionID that each touch keeps for all his 'life' until removed
Here is the code I have (stripped from my code)..
In setup() :
cp5 = new ControlP5(parent);
cp5.setAutoDraw(false);
cp5.getPointer().enable();
these two methods :
public void mousePressed()
{
cp5.getPointer().pressed();
}
public void mouseReleased()
{
cp5.getPointer().released();
}
And now, here is the code that handles TUIO Cursors..
public void addTuioCursor(TuioCursor tuioCursor)
{
int x = tuioCursor.getScreenX(width);
int y = tuioCursor.getScreenY(height);
cp5.getPointer().set(x ,y );
mousePressed();
}
public void updateTuioCursor(TuioCursor tuioCursor)
{
int x = tuioCursor.getScreenX(width);
int y = tuioCursor.getScreenY(height);
cp5.getPointer().set(x , y);
}
public void removeTuioCursor(TuioCursor tuioCursor)
{
mouseReleased();
}
With this implementation, I can see that, when I enter / mouser hover a controlP controller, it is highlighted as it's supposed to be (and i see the cross drawn in draw() where it should be).
But, when doing a "finger click" (i.e. adding then quickly removing a finger) over a highlighted controlP5 Button (for example), nothing happens ;- .
I would like a "finger click" to fire the controlP5 events as if my cursor was the mouse so I can use this **marvelous controlP5 library with SMT **!!
when you remove the cursor, also update the pointer and set the xy coordinates to a location outside of the controller area for example
cp5.getPointer().set(-1000 , -1000);
Do keep in mind to only use 1 TUIO cursor at a time with cp5's pointer.
Hm.. Ok for "just one pointer" part ..but,
in regard of the above code.. what exactly do you mean by > also update the pointer ?
A pseudo code example would help me..
It's kinda working and I can start from here :) ..
I've got a little flickering when hovering the dropDownLists, but my code needs to be refactored a bit and that should do the trick.
@sojamo : thanks again ! I don't know how to mark your answer as "accepted" .....
BTW have you heard of other P5 + controlP5 + multitouch projects ?
Comments
Hi, you can have a look at the ControlP5pointer example.
@sojamo : thanks for the quick answer ;)
Another question then..
In fact, I would like to emulate a mouseClick each time a TuioCursor (touch point on multitouch table) enters my scene..
The TuioCursors events are handled this way ;
add
is when a new touch point is added.update
is when a cursor is updated (has moved).remove
is when a cursor is removed.In each of these events, here are the infos I can get from the
TuioCursor
parameter :Here is the code I have (stripped from my code)..
In
setup()
:these two methods :
in
draw()
And now, here is the code that handles TUIO Cursors..
With this implementation, I can see that, when I enter / mouser hover a controlP controller, it is highlighted as it's supposed to be (and i see the cross drawn in
draw()
where it should be).But, when doing a "finger click" (i.e. adding then quickly removing a finger) over a highlighted controlP5 Button (for example), nothing happens ;- .
I would like a "finger click" to fire the controlP5 events as if my cursor was the mouse so I can use this **marvelous controlP5 library with SMT **!!
Any Idea ? (specially @sojamo and @paluka)..
Thanks in advance.
capturevision capturevision.wordpress.com
when you remove the cursor, also update the pointer and set the xy coordinates to a location outside of the controller area for example
cp5.getPointer().set(-1000 , -1000);
Do keep in mind to only use 1 TUIO cursor at a time with cp5's pointer.
Hm.. Ok for "just one pointer" part ..but, in regard of the above code.. what exactly do you mean by > also update the pointer ? A pseudo code example would help me..
Thanks ;)
Hi, here is a modified version of the pointer example, please have a look at the code inside keyPressed()
Hey thanks !
It's kinda working and I can start from here :) .. I've got a little flickering when hovering the dropDownLists, but my code needs to be refactored a bit and that should do the trick.
@sojamo : thanks again ! I don't know how to mark your answer as "accepted" .....
BTW have you heard of other P5 + controlP5 + multitouch projects ?