Mercurial > hg > dmlib
diff dmengine.h @ 342:c6ec970dc3cf
Separate some demo engine parts to two different modules.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 15 Oct 2012 21:25:51 +0300 |
parents | dmsimple.h@2d19b5b8350c |
children | cac13f180169 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dmengine.h Mon Oct 15 21:25:51 2012 +0300 @@ -0,0 +1,93 @@ +#ifndef DMSIMPLE_H +#define DMSIMPLE_H + +#include "dmlib.h" +#include <SDL_events.h> +#include <SDL_audio.h> +#include "dmres.h" + +#ifdef DM_USE_JSS +#include "jss.h" +#include "jssmod.h" +#include "jssmix.h" +#include "jssplr.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct +{ + int currFrame, endTime, startTime, + totalFrameTime, adjustTime, pauseTime; + + BOOL pauseFlag, paused, exitFlag; + SDL_Surface *screen; + SDL_Event event; + + SDL_AudioSpec optAfmt; + int optScrWidth, optScrHeight, optVFlags, optBitDepth, optResFlags; + char *optDataPath, *optPackFilename; + +#ifdef DM_USE_JSS + JSSMixer *dev; + JSSPlayer *plr; + int jss_format; +#endif + +#ifdef DM_USE_TREMOR + DMResource *audio; + size_t audioPos; +#endif + + int (*demoInit)(); + int (*demoInitPreVideo)(); + int (*demoInitPostVideo)(); + int (*demoRender)(); + void (*demoShutdown)(); + void (*demoQuit)(); + +} DMEngineData; + + +typedef struct +{ + int currFrame, endTime, startTime; +} DMFrameData; + + +extern DMEngineData engine; +extern DMFrameData frame; + + +#define engineGetResImage(x, name) \ + do { \ + if ((x = (SDL_Surface *) engineGetResource(name)) == NULL) \ + return DMERR_INIT_FAIL; \ + } while (0) + +#define engineGetResModule(x, name) \ + do { \ + if ((x = (JSSModule *) engineGetResource(name)) == NULL) \ + return DMERR_INIT_FAIL; \ + } while (0) + + +int engineClassifier(DMResource *res); +void * engineGetResource(const char *name); +int engineGetTime(int t); +int engineGetTimeDTi(); +int engineGetTick(); +float engineGetTimeDT(); + +int demoPreInit(); + + +#ifdef __cplusplus +} +#endif + +#endif // DMSIMPLE_H