|
SDLGameEngine
|
00001 #ifndef _SGEGAMESTATE_H 00002 #define _SGEGAMESTATE_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00012 /* 00013 * Copyright (c) 2007 Heiko Irrgang 00014 * 00015 * The license and distribution terms for this file may be 00016 * found in the file COPYING in this distribution or at 00017 * http://93-interactive.com/cms/products/software/sdl-game-engine/license/ 00018 */ 00019 00033 struct _SGEGAMESTATE; 00034 00041 typedef struct { 00043 int quit; 00044 SGEEVENTSTATE event_state; 00045 struct _SGEGAMESTATE *current; 00046 } SGEGAMESTATEMANAGER; 00047 00055 typedef struct _SGEGAMESTATE { 00057 SGEGAMESTATEMANAGER *manager; 00058 00060 void *data; 00061 00066 void (*onRedraw)(struct _SGEGAMESTATE *state); 00067 00076 int (*onKeyDown)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00077 00086 int (*onKeyUp)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00087 00096 int (*onJoystickButtonDown)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00097 00106 int (*onJoystickButtonUp)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00107 00113 void (*onJoystickMove)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00114 00120 void (*onMouseDown)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00121 00127 void (*onMouseUp)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00128 00134 void (*onMouseMove)(struct _SGEGAMESTATE *state, SGEEVENT *event); 00135 00142 int (*onStateChange)(struct _SGEGAMESTATE *state, struct _SGEGAMESTATE* previous); 00143 } SGEGAMESTATE; 00144 00148 SGEGAMESTATEMANAGER* sgeGameStateManagerNew(void); 00149 00155 int sgeGameStateManagerChange(SGEGAMESTATEMANAGER *manager, SGEGAMESTATE *next_state); 00156 00162 void sgeGameStateManagerRun(SGEGAMESTATEMANAGER* manager, int fps); 00163 00167 void sgeGameStateManagerQuit(SGEGAMESTATEMANAGER* manager); 00168 00178 SGEGAMESTATE* sgeGameStateNew(void); 00179 00180 // }@ 00181 00182 #ifdef __cplusplus 00183 } 00184 #endif 00185 00186 #endif