Mercurial > hg > dmlib
changeset 849:00729394df6a
Effects API changes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 21 Oct 2014 20:42:31 +0300 |
parents | 30f9af5e80f2 |
children | 9406aa7fdd61 |
files | src/dmengine.c src/dmengine.h |
diffstat | 2 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dmengine.c Tue Oct 21 20:10:27 2014 +0300 +++ b/src/dmengine.c Tue Oct 21 20:42:31 2014 +0300 @@ -59,8 +59,9 @@ for (i = 0; i < nengineEffects; i++) { - if (engineEffects[i].init != NULL && - (res = engineEffects[i].init(engine, &(engine->effectData[i]))) != DMERR_OK) + DMEffect *eff = &engineEffects[i]; + if (eff->init != NULL && + (res = eff->init(engine, eff, &engine->effectData[i])) != DMERR_OK) return res; } @@ -75,8 +76,9 @@ int i; for (i = 0; i < nengineEffects; i++) { - if (engineEffects[i].shutdown != NULL) - engineEffects[i].shutdown(engine, engine->effectData[i]); + DMEffect *eff = &engineEffects[i]; + if (eff->shutdown != NULL) + eff->shutdown(engine, eff, engine->effectData[i]); } dmFree(engine->effectData); engine->effectData = NULL; @@ -89,9 +91,10 @@ int i; for (i = 0; i < nengineEffects; i++) { - if (strcmp(engineEffects[i].name, name) == 0 && - engineEffects[i].nparams == nparams) - return &engineEffects[i]; + DMEffect *eff = &engineEffects[i]; + if (strcmp(eff->name, name) == 0 && + eff->nparams == nparams) + return eff; } return NULL; } @@ -102,8 +105,9 @@ int i; for (i = 0; i < nengineEffects; i++) { - if (strcmp(engineEffects[i].name, name) == 0) - return &engineEffects[i]; + DMEffect *eff = &engineEffects[i]; + if (strcmp(eff->name, name) == 0) + return eff; } return NULL; }
--- a/src/dmengine.h Tue Oct 21 20:10:27 2014 +0300 +++ b/src/dmengine.h Tue Oct 21 20:42:31 2014 +0300 @@ -116,14 +116,14 @@ struct DMEngineData; -typedef struct +typedef struct _DMEffect { char * name; int type; - - int (*init)(struct DMEngineData *, void **data); - void (*shutdown)(struct DMEngineData *, void *data); - int (*render)(SDL_Surface *screen, void *data, const DMTimelineEventParam *params, const int time); + + int (*init)(struct DMEngineData *, const struct _DMEffect *eff, void **data); + void (*shutdown)(struct DMEngineData *, const struct _DMEffect *eff, void *data); + int (*render)(SDL_Surface *screen, const struct _DMEffect *eff, void *data, const DMTimelineEventParam *params, const int time); int nparams; DMTimelineEventParam params[DT_MAX_EFFECT_PARAMS];