view dmsimple.h @ 93:15fdd5573344

Add simple (and buggy / not really working) debug mode.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Oct 2012 18:13:05 +0300
parents d1a6833a5d67
children 4bbfc0274b29
line wrap: on
line source

#ifndef DMSIMPLE_H
#define DMSIMPLE_H

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

#include "jss.h"
#include "jssmod.h"
#include "jssmix.h"
#include "jssplr.h"


typedef struct
{
    int currFrame, endTime, startTime,
        totalFrameTime, adjustTime, pauseTime;

    BOOL pauseFlag, paused, exitFlag;
    SDL_Surface *screen;
    SDL_Event event;

    int optScrWidth, optScrHeight, optVFlags, optBitDepth;

    JSSMixer *dev;
    JSSPlayer *plr;

#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    demoGlobalInit();
int    demoPreInit();
int    demoMainTick();
void   demoFinish();

#endif // DMSIMPLE_H