hey jim im just messing around with your escher state machine the now im trying to get it to go into a class and im nearly all the way there but im having a spot of bother here.
typedef enum
{
STATE_INIT,
STATE_SHUTDOWN,
STATE_USER=STATE_SHUTDOWN,
//put user states here
STATE_DINGOSDREAM,
//end user states
STATE_LAST,
//flags controlling state control
STATE_NEXT=0x20000000,
STATE_PREV=0x40000000
} GAME_STATE;
typedef struct
{
void (*init)(void);
GAME_STATE (*main)(void);
void (*shutdown)(void);
char *title;
} GAME_JUMPS;
#define START_STATE STATE_DINGOSDREAM
class StateMachine
{
public:
StateMachine( HWND Hwnd, HDC Hdc );
~StateMachine();
void init_state_machine( void );
bool run_state_machine( void );
void kill_state_machine( void );
void set_state_override( GAME_STATE );
void global_init( void );
void global_shutdown( void );
GAME_STATE global_main( void );
void empty_init( void );
void empty_shutdown( void );
GAME_STATE empty_main( void );
void DingosDreamInit( void );
GAME_STATE DingosDreamMain( void );
void DingosDreamShutDown( void );
//**problem here***
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
GAME_JUMPS game_states[] =
{
{global_init, global_main, empty_shutdown, "startup"},
{empty_init, empty_main, global_shutdown, "shutdown"},
{DingosDreamInit, DingosDreamMain, DingosDreamShutDown, "DingosDream"},
};
//-------------------------------------------------------------------------------------
private:
HWND CurWindow ;
HDC CurHdc ;
GAME_STATE curr_state;
GAME_STATE state_override;
};
and i get lots of errors like this.
Error 2 error C2334: unexpected token(s) preceding '{'; skipping apparent function body e:\documents and settings\nino\desktop\apophis\ApophisStateMachine.h 53
it obviously builds when its not in a class form but im no expert with classes so i cant see how to make it work.
if you like i can upload the project its in vc as i finaly got round to learning it.