I finished a first version of a TUIO Client class for OF. It uses ofxOSC so it’s really easy to use. Right now I only tested it in xCode on Mac but it should work cross plattform (because of ofxOSC). You can download it at: http://addons.openframeworks.cc/projects/show/ofxtuio
If you find any bugs please tell me. Furthermore you can also improve things in general if you want to since I am pretty new to c++ and programing in general.
For future releases I plan to add 3D tuio support.
Thanks!
I actually used the processing and c++ classes from reactivision as reference. I also plan to add events. If anybody else wants to add things just gor for it because I need to wrap my head around it first.
What would be the best way to implement events? Maybe Using poco?
The way to go to implement events, is poco, with a particular pattern to hide the implementation details from the users, you can take a look at ofxMailUtils, to see how it’s organized. The trickiest part is the forward declaration of the listener and manager in the .h file for the class that generates the events (in my case ofxMailUtils.h)
Also if you can wait, I have a python tool to generate the code for the events, it’s not yet working for the very last implementation, but it should be easy to modify. I’ll post when it’s complete.
that sounds great arturo! I have time, right now I don’t need any events. I only need cursor positions right now since it will only be used for some tracking. I will take a look at your src code anyways. And please let me know when your tool is done!
okay thanks, I will see if I can figgure out a way how to implement the events as easy as possible. if I understand you correctly you would write a class that contains all the poco stuff (like the ofxPop3EventListener in your ofxMailUtils).
Yes, you should have an events folder in your addon, and there a .h file that contains a listener, a manager and perhaps another class for the parameters of the event.
The listener is the class you inherit to be able to receive the events from your app.
The manager implements the addListener, removeListener and notify methods that manage all the poco related stuff. You can have different methods for this: don’t remember the tuio events but can be something like:
addNewObjectListener, addObjectRotatedListener…
Then for your addon I suppose you will only need to register listeners to one instance (there are no separate controls to which you need to register listeners independently) so you can create a global instance of the manager, that should be called something like ofxTuioEvents so you can register listeners by calling
ofxTuioEvents.addListener(this);
Take a look at ofMouseEvents.h, I think is the most similar to what you need
If you have any problems just post when you have something done, and i’ll try to help.
Well yes it’s always down if it’s alive, but you usually need to know when it was first down. So a down event would be when it’s first down, just lick when a mouse is first pressed. Then move (or update) would be where it is after the initial down and up would be an event sent when it’s no longer alive.
You can see where we send events in the AS3 flash TUIO classes I posted in your other thread. We also dispatch events for rollover, rollout. I’m not sure how all that translates to C++.
I rewrote ofMouseEvents just for testing and added it to simple app like that:
class testApp : public ofSimpleApp, public ofxTuioEventListener{...}
Then in setup I added it to the events manager like that:
ofxTuioEvents.addListener(this);
that works so far. is that the way you wanted to implement it? I am actually really confused about how to progress from there and if this is the way I should be doing it.
PS: I also added a video so you don’t need to download it if you just want to see what this is about: http://vimeo.com/1990755
THanks again arturo. I added some notifications in the ofxTuioClient.h and I at least get the notifications. Anyways they don’t seem to be “blob specific” right now.
that seems ok to me. The only thing, change the names of the methods in the listener to tuioMoved, tuioUp and tuioDown. Up, down and moved are pretty generic and can be problematic. And some methods like addupListener to addUpListener: note the capital U in Up, and sorry for being so picky
If you want the events to be blob specific, I suppose every blob has its id. Take a look at the events in ofxMidiIn (in the addons site). There i’m using a map to store a different poco BasicEvent for each midi controller id. This should be more or less the same.
Am trying out your ofxTUIO addon…but i do not have poco. I’m compiling your example with VS2008 and was wondering how to install poco such that it works with my current OF0.05FAT. There are a few poco-OF installations floating around on the forum but I do not know which ones I should be using. Any brief instructions would be appreciated.