Compiler warning using SDL_SetTimer

Hi,

Could anyone help me with the following C++ code:

When using the call

SDL_SetTimer( (33/10)*10, &update );

where update is

Uint32 Controller::update() {
// code here
}

I get this warning

warning: converting from `unsigned int (Controller::*)()' to 
`unsigned int (*)(unsigned int)'

While this isn’t causing problems I would very much like to eliminate
the warning during compilation. Any comments or suggestions would
be appreciated.

Thanks,

Matt

Could anyone help me with the following C++ code:

When using the call

SDL_SetTimer( (33/10)*10, &update );

where update is

Uint32 Controller::update() {
// code here
}

This needs to be a static member function and you need to keep the Controller
object in a global somewhere. This is because Controller::update() takes
a hidden “this” parameter, which is used to dereference any class-local
variables, and is not passed to the timer function.

If you need it, I can have the timer callback get passed a void pointer
which you can cast to a Controller object, and access via a friend function.

Just a couple of thoughts…

See ya!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/