/* * TimeEvent * * Keep track of when and where the screen was clicked */ class TimeEvent { int event_none = 0; int event_down = 1; int event_up = 2; float time = 0.0; float duration = 0.0; float animateTime = 0.0; int mx = 230; int my = 330; int event = event_none; // constructor. TimeEvent() { time = 0.0; duration = 0.0; mx = 230; my = 330; } // sets the current time in this node to "NOW" void now( int evt ) { event = evt; time = millis(); } // update the duration void updateDuration() { duration = millis() - time; } // sets the current location in this node to "HERE" void here() { updateDuration(); mx = mouseX; my = mouseY; } // sets this one from the passed-in one void copyFrom( TimeEvent t ) { mx = t.mx; my = t.my; time = t.time; duration = t.duration; event = t.event; } // display the contents in a single line for debug void debugPrint() { println( event + " " + mx + " " + my + " " + time + " " + duration + " " + animateTime ); } }