Hi,
I'm trying out some new ideas on how to structure my programs, basically, the idea is this:
The main loop calls a function, constantly, Process();, which will point to the correct event processor, depending on what's happening, menu showing, in-game, whatever. Each of the things, menu, in-game, have their own class, and some common variables etc..., which is in cBase, and they inherit that, now whenever the process changes, from the menu to in-game for example, I just update the Process(); function to point to the new function, and it continues as normal.
However, I'm having a little problem with the code to do this.
This is the code I'm using
cGame *gameClass = new cGame;
void (*Process)( void );
Process = &gameClass->ProcessLoop;
however, it gives the following compile time error:
Error : illegal implicit conversion from 'void (*)()' to
'void (*)()'
GlooP.cpp line 74 Process = &gameClass->ProcessLoop;
I have tried doing something like:
void (cBase::*Process)( void );
(where cBase is the base class cGame, cMainMenu and cLevelEditor inherit) - but that just gives different errors.
Any ideas, things you can point me to to read, etc...?
Many thanks,
-Toris
[edited by - Toris on January 11, 2004 7:39:26 PM]