Setting a timer callback within a class
2 posters
Setting a timer callback within a class
Hi,
I have emebdded an SIO2timer inside a class. I'm using this code in my class constructor:
sio2TimerCreate(wobble_timer, sio2->_SIO2window, wobble, WOBBLE_TIMER_INCREMENT);
Then I have the callback defined as:
void MyClass::wobble(void *){
printf("calling\n");
}
XCode gives me this error:
template.mm:859: error: argument of type 'void (MyClass:(void*)' does not match 'void (*)(void*)'
Thanks in advance,
-joshua
I have emebdded an SIO2timer inside a class. I'm using this code in my class constructor:
sio2TimerCreate(wobble_timer, sio2->_SIO2window, wobble, WOBBLE_TIMER_INCREMENT);
Then I have the callback defined as:
void MyClass::wobble(void *){
printf("calling\n");
}
XCode gives me this error:
template.mm:859: error: argument of type 'void (MyClass:(void*)' does not match 'void (*)(void*)'
Thanks in advance,
-joshua
meteors- Posts : 241
Join date : 2008-11-08
Location : Sunny Florida
Re: Setting a timer callback within a class
I think that the error message that XCode give you is pretty self explanatory... your function have to fit the following type: typedef void( SIO2timercallback( void * ) );
If you want to put this in a class you should do something like this:
Then assign a void function( void * ) to it...
or directly:
sio2TimerCreate(wobble_timer, sio2->_SIO2window, mobble, WOBBLE_TIMER_INCREMENT);
If you want to put this in a class you should do something like this:
- Code:
class MyClass
{
public:
SIO2timercallback *_SIO2timercallback;
}
Then assign a void function( void * ) to it...
- Code:
void wobble( void *_ptr )
{
}
_SIO2timercallback = wobble;
sio2TimerCreate(wobble_timer, sio2->_SIO2window, myobject->_SIO2timercallback, WOBBLE_TIMER_INCREMENT);
or directly:
sio2TimerCreate(wobble_timer, sio2->_SIO2window, mobble, WOBBLE_TIMER_INCREMENT);
Similar topics
» animation completed callback?
» Trying to add a new class
» Setting Camera Physics in Blender
» old class members, what are they now?
» Setting up a new project...
» Trying to add a new class
» Setting Camera Physics in Blender
» old class members, what are they now?
» Setting up a new project...
Permissions in this forum:
You cannot reply to topics in this forum