view dmsimple.h @ 105:d5d27f262227

Beging merging of dmsimple2-fork into the main "engine".
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 03 Oct 2012 09:16:26 +0300
parents 4bbfc0274b29
children 8db49a23b393
line wrap: on
line source

#ifndef DMSIMPLE_H
#define DMSIMPLE_H

#include "dmlib.h"
#include "dmargs.h"
#include "dmres.h"
#include "dmimage.h"

#ifdef DM_USE_JSS
#include "jss.h"
#include "jssmod.h"
#include "jssmix.h"
#include "jssplr.h"
#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;
#endif

#ifdef DM_USE_TREMOR
    DMResource *audio;
    int audioPos;
#endif

#ifdef DM_DEBUG
    BOOL optDebug;
    Uint8 *audioBuf;
    int audioBufSize;
    int audioSamples;
    int demoDuration;
#endif
} 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)


void * engineGetResource(const char *name);
int    engineGetTime(int t);
int    engineGetTimeDTi();
int    engineGetTick();
float  engineGetTimeDT();

int    demoInit();
int    demoPreInit();
int    demoMainTick();
void   demoShutdown();
void   demoQuit();

#endif // DMSIMPLE_H