In the Sample code provided in the SDK, the function __cdecl DataHandler is responsible for receiving data from server? Am I right?
My application is fully object oriented so I will need to encapsulate this function.
Eg: void myClass::__cdecl DataHandler(sFrameOfMocapData* data, void* pUserData)
How can I do it? Or is there any other way that i can obtain data from the server.
Looking forward for your answers.
Can i encapsulate this function __cdecl DataHandler?
-
- NaturalPoint Employee
- Posts: 199
- Joined: Tue Jun 24, 2008 2:01 pm
- Location: Corvallis, OR, USA
- Contact:
Re: Can i encapsulate this function __cdecl DataHandler?
Yes you can do this by declaring the member function static:
static void DataHandler(sFrameOfMocapData* data, void* pUserData);
If you need access to the class instance during the callback, you can pass an instance of the class to SetDataCallback. Something like:
theClient->SetDataCallback( pMyObject->DataHandler, pMyObject );
hope this helps,
Morgan
static void DataHandler(sFrameOfMocapData* data, void* pUserData);
If you need access to the class instance during the callback, you can pass an instance of the class to SetDataCallback. Something like:
theClient->SetDataCallback( pMyObject->DataHandler, pMyObject );
hope this helps,
Morgan