SDL_Console and c++

I am trying to add a console command to SDL_Console…

void CGame::cLoadLevel(ConsoleInformation *console, char *String)
{
Stop(); // Do a full clean
Init(mScreen); // And reset
Play(String); // and Play again
}

void CGame::InitCommands(void)
{
CON_Topmost(iConsole);
// Add Commands…
CON_AddCommand(&cLoadLevel, “map”);
}

However, i get the error :

error C2276: ‘&’ : illegal operation on bound member function expression

Anyone know how i can solve this?

Thanks

C++ member callbacks are not as trivial as plain C callbacks. :))

Take a look at:
http://www.parashift.com/c++-faq-lite/pointers-to-members.html

AlexAm Son, 2002-03-24 um 13.32 schrieb MangoMan:

I am trying to add a console command to SDL_Console…

void CGame::cLoadLevel(ConsoleInformation *console, char *String)
{
Stop(); // Do a full clean
Init(mScreen); // And reset
Play(String); // and Play again
}

void CGame::InitCommands(void)
{
CON_Topmost(iConsole);
// Add Commands…
CON_AddCommand(&cLoadLevel, “map”);
}

However, i get the error :

error C2276: ‘&’ : illegal operation on bound member function expression

Anyone know how i can solve this?

Thanks


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

What I did to get around this problem (not sure if its the right way to do things or not) is to have some global
functions and have the console call those. In those functions I would post a message which would tell SDL what
to do. Haven’e had any problems with that method so far.
3/24/2002 8:25:33 AM, Alexander Pipelka wrote:>C++ member callbacks are not as trivial as plain C callbacks. :))

Take a look at:
http://www.parashift.com/c++-faq-lite/pointers-to-members.html

Alex

Am Son, 2002-03-24 um 13.32 schrieb MangoMan:

I am trying to add a console command to SDL_Console…

void CGame::cLoadLevel(ConsoleInformation *console, char *String)
{
Stop(); // Do a full clean
Init(mScreen); // And reset
Play(String); // and Play again
}

void CGame::InitCommands(void)
{
CON_Topmost(iConsole);
// Add Commands…
CON_AddCommand(&cLoadLevel, “map”);
}

However, i get the error :

error C2276: ‘&’ : illegal operation on bound member function expression

Anyone know how i can solve this?

Thanks


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl