Problem in implementing Tap and Hold .
in
Contributed Library Questions
•
2 years ago
Hello,
I want to implement Tap and Hold in my processing app.To implement this I need to store the time when cursor was added and keep checking the difference of it from current system time till it exceeds the certain threshold value.
For this I took TuioTime when cursor was added and converted it into seconds.
float sTime = tcur.getTuioTime().getTotalMilliseconds()*0.001;
Also at the same time I retrieved System time too and converted it into seconds but both of these are quite different.
I am not getting why is this happening?
The complete code is as :
import TUIO.*;
TuioProcessing tp;
void setup()
{
size(700,700,P2D);
tp = new TuioProcessing(this);
}
void draw()
{
}
// called when an object is added to the scene
void addTuioObject(TuioObject tobj)
{
}
// called when an object is removed from the scene
void removeTuioObject(TuioObject tobj)
{
}
// called when an object is moved
void updateTuioObject (TuioObject tobj)
{
}
// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur)
{
float sTime = tcur.getTuioTime().getTotalMilliseconds()*0.001; //*0.000001;
println("cursor added at:"+sTime);
int h = hour();
int m = minute();
int s = second();
int systime = h*3600+m*60+s;
println("systime : "+systime);
}
// called when a cursor is moved
void updateTuioCursor (TuioCursor tcur)
{
}
// called when a cursor is removed from the scene
void removeTuioCursor(TuioCursor tcur)
{
}
// called after each message bundle
// representing the end of an image frame
void refresh(TuioTime bundleTime) {
redraw();
}
and the output on console window was :
cursor added at :3.9800003
systime : 62630
Please help.
1