Hi all,
i am trying to make my own MT apps into OF.
I followed the good ofxMultiTouchActionsExample (http://code.google.com/p/smallfly/downloads/list).
I have some errors: the buttons do not deal with the input data and neither the functions (background change with slider movements).
With markers, everything is good.
Here some code:
in testApp.cpp:
...
button.registerForMultitouchEvents();
....
....
bSlider.setPriorityLevel(3);
bSlider.registerForMultitouchEvents();
tRange = new int[1];
tRange[0] = 1;
bSlider.setIsDraggable(true, tRange, 1, false, true);
delete [] tRange;
//----------------
mtActionsHub.addObject(&draggableRotatableScalableItem);
mtActionsHub.addObject(&scalableItem);
mtActionsHub.addObject(&draggableItem);
mtSliderHub.addObject(&rSlider);
mtSliderHub.addObject(&gSlider);
mtSliderHub.addObject(&bSlider);
ofAddListener(rSlider.eMultiTouchMoved,this,&testApp::updateBackgroundColor);
ofAddListener(gSlider.eMultiTouchMoved,this,&testApp::updateBackgroundColor);
ofAddListener(bSlider.eMultiTouchMoved,this,&testApp::updateBackgroundColor);
//add button event listener for global callback function in testApp
ofAddListener(buttonTwo.eMultiTouchUp,this,&testApp::buttonTwoCallback);
//ofAddListener(button.eMultiTouchUp,this,&testApp::buttonTwoCallback);
....
....
void testApp::tuioObjectAdded(TuioObject & tobj){
cout << " object added: " + ofToString(tobj.getSymbolID())+
" X: "+ofToString(tobj.getX())+
" Y: "+ofToString(tobj.getY())+
" angle: "+ofToString(tobj.getAngleDegrees())
<< endl;
//forward the marker events to ofxMarker for the InteractiveObjects
ofxMarker.markerDown(tobj.getSymbolID(), tobj.getX(), tobj.getY(), tobj.getAngleDegrees());
}
void testApp::tuioCursorAdded(TuioCursor & tcur){
cout << " cursor added: " + ofToString(tcur.getCursorID())+
" X: "+ofToString(tcur.getX())+
" Y: "+ofToString(tcur.getY())
<< endl;
ofxMultiTouchCustomDataSF multiTouchCustomData;
multiTouchCustomData.sessionID = tcur.getSessionID();
mtActionsHub.touchDown(tcur.getX(), tcur.getY(), tcur.getCursorID(), &multiTouchCustomData);
mtSliderHub.touchDown(tcur.getX(), tcur.getY(), tcur.getCursorID(), &multiTouchCustomData);
/*
draggableRotatableScalableItem.touchDown(tcur.getX(), tcur.getY(), tcur.getCursorID(), &multiTouchCustomData);
if(draggableRotatableScalableItem.ownTouchCursor(tcur.getSessionID())) {
return;
}
*/
//forward the touch events to ofxMultiTouch for the InteractiveObjects
ofxMultiTouch.touchDown(tcur.getX(), tcur.getY(), tcur.getCursorID(), &multiTouchCustomData);
}
Seems that ofxMultitouch.touchDown is not forwarding that to the buttons…
It works with ofxMarker.markerDown(tobj.getSymbolID(), tobj.getX(), tobj.getY(), tobj.getAngleDegrees());.
Any ideas?
Arent we mixing old .touchDown with the new built in .touchDown?
And the main point:
How to do a interactive button, etc. In OF 0.07, using built in events?
How to make in listen to touchDown?
How to pass tuio messages to events?
Any tutorial about MT in OF would be great. Once i understand that i will make one !
thank you,
miguel.
www.tangiblex.net