[SDL] Making a GUI system in SDL

Gregory Smith wolfy at treellama.org
Mon Feb 11 12:01:53 PST 2008


On Mon, 11 Feb 2008, L-28C wrote:

> I tried to place a function pointer called "m_pfnOnClickEvent" and let 
> the main application set a function to it when it creates the button... 
> but C++ doesn't let you put member methods onto function pointers, and 
> my program is 100% object-oriented.

There's an example of doing nearly exactly what you want using boost::bind 
and boost::function here:

http://www.boost.org/libs/bind/bind.html#with_boost_function

Might upset old C fogeys on this list, but give it a try if you're looking 
for a more modern way to do callbacks ;)

Gregory


More information about the SDL mailing list