Mercurial > hg > dmlib
view dmtimeline.h @ 320:fc79b57d4646
Add in unfinished timeline code.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 14 Oct 2012 14:24:11 +0300 |
parents | |
children | f2b65aa474c9 |
line wrap: on
line source
#ifndef DMTIMELINE_H #define DMTIMELINE_H #include "dmlib.h" #include "dmres.h" #ifdef __cplusplus extern "C" { #endif #define DT_MAX_EFFECT_PARAMS 16 #define DT_MAX_NAME_LENGTH 32 #define DT_FLOAT_STORE_SIZE 16 enum { EFIT_SET, // No interpolation, just "set" the value EFIT_LINEAR, // Linear interpolation EFIT_SMOOTH, // Smoothstep interpolation }; enum { EFPT_POINTS, EFPT_INT, EFPT_FLOAT, EFPT_STRING, }; typedef struct { int type; // Interpolation type (EFIT_*) between this and next point int time; // Offsets to event start, -1 == attach to event start, -2 = event end (if event) DMFloat value; } DMTimelinePoint; typedef struct { int npoints, nallocated; DMTimelinePoint *points; } DMTimelinePoints; typedef struct { char *name; // Name / description of the parameter int type; // Type (EFPT_*) char *vstr; int vint; DMFloat vfloat; DMTimelinePoints vpoints; // Execution related DMLerpContext lerp; } DMTimelineEventParam; typedef struct { char name[DT_MAX_NAME_LENGTH]; Uint32 type; } DMFTimelineEventParam; typedef struct { char * name; int type; int (*init)(void **data); void (*shutdown)(void *data); int (*render)(SDL_Surface *screen, void *data, const DMTimelineEventParam *params); int nparams; DMTimelineEventParam params[DT_MAX_EFFECT_PARAMS]; } DMEffect; typedef struct { Uint32 startTime, duration; char effectName[DT_MAX_NAME_LENGTH]; Uint32 nparams; } DMFTimelineEvent; typedef struct { int startTime, duration; DMEffect *effect; int nparams; DMTimelineEventParam *params; } DMTimelineEvent; typedef struct { BOOL enabled; DMTimelinePoints points; } DMTimelineCurve; typedef struct { char name[DT_MAX_NAME_LENGTH]; Uint8 enabled; Uint32 nevents; } DMFTimelineTrack; typedef struct { char *name; // Name of the timeline track BOOL enabled; // Enabled? int nevents; // Number of events DMTimelineEvent **events; // Events DMTimelineCurve composite; // Composite curve (transparency of the "layer") } DMTimelineTrack; typedef struct { DMTimelineTrack *track; DMTimelineEvent *event; } DMPreparedEvent; typedef struct { int start, end, nevents; DMPreparedEvent *events; } DMPreparedEventGroup; typedef struct { char magic[8]; char name[DT_MAX_NAME_LENGTH]; Uint32 ntracks; Uint32 duration; } DMFTimeline; typedef struct { char *name; int ntracks, duration; DMTimelineTrack **tracks; // Prepared data int nevents; DMPreparedEventGroup *pevents; } DMTimeline; extern DMEffect *dmEffects; extern int ndmEffects, ndmEffectsAlloc; extern void **dmEffectData; int dmRegisterEffect(const DMEffect *ef); int dmInitializeEffects(); void dmShutdownEffects(); int dmLoadTimeline(DMResource *res, DMTimeline **tl); int dmSaveTimeline(DMResource *res, DMTimeline *tl); void dmFreeTimeline(DMTimeline *tl); int dmPrepareTimeline(DMTimeline *tl); int dmSeekTimeline(DMTimeline *tl, int time); int dmExecuteTimeline(DMTimeline *tl, SDL_Surface *screen, int time); #ifdef __cplusplus } #endif #endif // DMTIMELINE_H