Basic Touchlib Application
From NUI Group Community Wiki
A simple Touchlib application.
ITouchScreen *screen; class MyApp : public ITouchListener { public: MyApp () { } // Just implement these 3 functions to recieve touch events. //! Notify that a finger has just been made active. virtual void fingerDown(TouchData data) { printf("Press detected: %f, %f\n", data.X, data.Y); } //! Notify that a finger has moved virtual void fingerUpdate(TouchData data) { } //! A finger is no longer active.. virtual void fingerUp(TouchData data) { } void frame() { } } main() { OSCApp app; screen = TouchScreenDevice::getTouchScreen(); if(!screen->loadConfig("config.xml")) exit(0); // error screen->registerListener((ITouchListener *)&app); // Note: Begin processing should only be called after the screen is set up screen->beginProcessing(); screen->beginTracking(); do { // main loop.. do any graphics or sound updates // .... screen->getEvents(); app.frame(); } while( stillrunning ); TouchScreenDevice::destroy(); return 0; }
The .vcproj file should have dependencies something like the following : AdditionalDependencies="cv.lib cxcore.lib highgui.lib tinyxml.lib cvcam.lib winmm.lib VideoWrapper.lib DSVL.lib 1394camera.lib"
--- Example for Visual Studio and Linux (includes vcproj files and Makefiles) http://nuigroup.com/forums/viewthread/1380/#9652