Mercurial > hg > dmlib
annotate dmengine.h @ 641:c3852e49a610
Change how audio configuration works.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 15 Apr 2013 09:20:45 +0300 |
parents | b22db2832f3e |
children | 0888971cbff8 |
rev | line source |
---|---|
372 | 1 #ifndef DMENGINE_H |
2 #define DMENGINE_H | |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 #include "dmlib.h" |
310
713c8018c3ce
Fix includes in the dmsimple engine.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
5 #include <SDL_events.h> |
713c8018c3ce
Fix includes in the dmsimple engine.
Matti Hamalainen <ccr@tnsp.org>
parents:
288
diff
changeset
|
6 #include <SDL_audio.h> |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 #include "dmres.h" |
368 | 8 #include "dmvecmat.h" |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
10 #ifdef DM_USE_JSS |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 #include "jss.h" |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 #include "jssmod.h" |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 #include "jssmix.h" |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 #include "jssplr.h" |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
15 #endif |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 |
317 | 18 #ifdef __cplusplus |
19 extern "C" { | |
20 #endif | |
21 | |
593 | 22 // Video setup screen / window size |
620 | 23 #define DM_VSETUP_WIDTH 640 |
24 #define DM_VSETUP_HEIGHT 480 | |
593 | 25 |
597
8a9361179a1a
More work on the video setup screen.
Matti Hamalainen <ccr@tnsp.org>
parents:
593
diff
changeset
|
26 |
593 | 27 // Video setup type |
641
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
28 enum |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
29 { |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
30 DM_VSETUP_NONE = 0x00, // No video setup, just set window/screen to what demo specifies |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
31 DM_VSETUP_ASPECT = 0x01, // Only modes that match the optVidAspect aspect ratio are ok |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
32 DM_VSETUP_ANY = 0x02, // Any available mode is okay, the code can adapt |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
33 }; |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
34 |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
35 // Audio setup type |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
36 enum |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
37 { |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
38 DM_ASETUP_NONE = 0, |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
39 DM_ASETUP_JSS = 1, |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
40 DM_ASETUP_TREMOR = 2, |
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
41 }; |
593 | 42 |
43 | |
317 | 44 |
368 | 45 #define DT_MAGIC_ID "SDMETLNE" |
46 #define DT_MAX_EFFECT_PARAMS 16 | |
47 #define DT_MAX_NAME_LENGTH 32 | |
48 #define DT_FLOAT_STORE_SIZE 16 | |
49 | |
50 | |
51 enum | |
52 { | |
53 EFIT_SET, // No interpolation, just "set" the value | |
54 EFIT_LINEAR, // Linear interpolation | |
55 EFIT_SMOOTH, // Smoothstep interpolation | |
56 }; | |
57 | |
58 enum | |
59 { | |
60 EFPT_INT, | |
61 EFPT_FLOAT, | |
62 EFPT_STRING, | |
63 EFPT_VECTOR, | |
64 EFPT_MATRIX, | |
65 }; | |
66 | |
67 | |
68 typedef struct | |
69 { | |
70 int type; // Interpolation type (EFIT_*) between this and next point | |
71 int time; // Offsets to event start, -1 == attach to event start, -2 = event end (if event) | |
72 | |
73 int vint; | |
74 DMFloat vfloat; | |
75 DMVector vector; | |
76 DMMatrix matrix; | |
77 } DMTimelinePoint; | |
78 | |
79 | |
80 typedef struct | |
81 { | |
82 int npoints, nallocated; | |
83 DMTimelinePoint *points; | |
84 } DMTimelinePoints; | |
85 | |
86 | |
87 typedef struct | |
88 { | |
89 char *name; // Name / description of the parameter | |
90 int type; // Type (EFPT_*) | |
91 | |
92 DMTimelinePoints pts; | |
93 char *vstr; | |
94 | |
95 // Current values (interpolated) | |
96 int vint; | |
97 DMFloat vfloat; | |
98 DMVector vvector; | |
99 DMMatrix vmatrix; | |
100 } DMTimelineEventParam; | |
101 | |
102 | |
103 typedef struct | |
104 { | |
105 char name[DT_MAX_NAME_LENGTH]; | |
106 Uint32 type; | |
107 } DMFTimelineEventParam; | |
108 | |
109 | |
110 struct DMEngineData; | |
111 | |
112 | |
113 typedef struct | |
114 { | |
115 char * name; | |
116 int type; | |
117 | |
118 int (*init)(struct DMEngineData *, void **data); | |
119 void (*shutdown)(struct DMEngineData *, void *data); | |
120 int (*render)(SDL_Surface *screen, void *data, const DMTimelineEventParam *params, const int time); | |
121 | |
122 int nparams; | |
123 DMTimelineEventParam params[DT_MAX_EFFECT_PARAMS]; | |
124 } DMEffect; | |
125 | |
126 | |
573
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
127 #ifdef DM_USE_TIMELINE |
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
128 |
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
129 |
368 | 130 typedef struct |
131 { | |
132 Uint32 start, duration; | |
133 char effectName[DT_MAX_NAME_LENGTH]; | |
134 Uint32 nparams; | |
135 } DMFTimelineEvent; | |
136 | |
137 | |
138 typedef struct | |
139 { | |
140 int start, duration; | |
141 DMEffect *effect; | |
142 int nparams; | |
143 DMTimelineEventParam *params; | |
144 } DMTimelineEvent; | |
145 | |
146 | |
147 typedef struct | |
148 { | |
149 BOOL enabled; | |
150 DMTimelinePoints points; | |
151 } DMTimelineCurve; | |
152 | |
153 | |
154 typedef struct | |
155 { | |
638
b22db2832f3e
Some work on the timeline code.
Matti Hamalainen <ccr@tnsp.org>
parents:
636
diff
changeset
|
156 Uint32 index, layer; |
368 | 157 char name[DT_MAX_NAME_LENGTH]; |
158 Uint8 enabled; | |
159 Uint32 nevents; | |
160 } DMFTimelineTrack; | |
161 | |
162 | |
163 typedef struct | |
164 { | |
638
b22db2832f3e
Some work on the timeline code.
Matti Hamalainen <ccr@tnsp.org>
parents:
636
diff
changeset
|
165 int index; // Track index |
b22db2832f3e
Some work on the timeline code.
Matti Hamalainen <ccr@tnsp.org>
parents:
636
diff
changeset
|
166 int layer; // Target render layer (0 = engine.screen in software rendering) |
368 | 167 char *name; // Name of the timeline track |
168 BOOL enabled; // Enabled? | |
169 | |
170 int nevents, nallocated; // Number of events | |
171 DMTimelineEvent **events; // Events | |
172 | |
173 DMTimelineCurve composite; // Composite curve (transparency of the "layer") | |
174 } DMTimelineTrack; | |
175 | |
176 | |
177 typedef struct | |
178 { | |
179 char magic[8]; | |
180 char name[DT_MAX_NAME_LENGTH]; | |
181 Uint32 ntracks; | |
182 Uint32 duration; | |
183 } DMFTimeline; | |
184 | |
185 | |
186 typedef struct | |
187 { | |
188 char *name; | |
189 int ntracks, nallocated, duration; | |
190 DMTimelineTrack **tracks; | |
191 } DMTimeline; | |
192 | |
193 | |
194 typedef struct | |
195 { | |
196 DMTimelineTrack *track; | |
197 DMTimelineEvent *event; | |
198 } DMPreparedEvent; | |
199 | |
200 | |
201 typedef struct _DMPreparedEventGroup | |
202 { | |
203 int start, end, nevents, nallocated; | |
204 DMPreparedEvent *events; | |
205 | |
206 struct _DMPreparedEventGroup *next, *prev; | |
207 } DMPreparedEventGroup; | |
208 | |
209 | |
210 typedef struct | |
211 { | |
212 int duration, ngroups, pos; | |
213 DMPreparedEventGroup **groups; | |
214 } DMPreparedTimeline; | |
215 | |
573
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
216 #endif |
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
217 |
368 | 218 |
367 | 219 typedef struct DMEngineData |
359
59045853853d
Make resource management re-entrant.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
220 { |
59045853853d
Make resource management re-entrant.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
221 DMResourceLib *resources; |
368 | 222 void **effectData; |
359
59045853853d
Make resource management re-entrant.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
223 |
573
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
224 #ifdef DM_USE_TIMELINE |
354 | 225 DMResource *timeline; |
345
cac13f180169
Work towards timeline support.
Matti Hamalainen <ccr@tnsp.org>
parents:
342
diff
changeset
|
226 DMTimeline *tl; |
cac13f180169
Work towards timeline support.
Matti Hamalainen <ccr@tnsp.org>
parents:
342
diff
changeset
|
227 DMPreparedTimeline *ptl; |
573
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
228 #endif |
345
cac13f180169
Work towards timeline support.
Matti Hamalainen <ccr@tnsp.org>
parents:
342
diff
changeset
|
229 |
361 | 230 int frameTime, frameCount, |
231 startTime, endTime, | |
390
a7ee3567f718
Remove adjustTime variable, it is not needed anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
382
diff
changeset
|
232 pauseTime; |
93
15fdd5573344
Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
32
diff
changeset
|
233 |
15fdd5573344
Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
32
diff
changeset
|
234 BOOL pauseFlag, paused, exitFlag; |
361 | 235 |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
236 SDL_Surface *screen; |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
237 SDL_Event event; |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
238 SDL_AudioSpec optAfmt; |
641
c3852e49a610
Change how audio configuration works.
Matti Hamalainen <ccr@tnsp.org>
parents:
638
diff
changeset
|
239 int optAudioSetup; |
578
cf5d44b36851
Add some initial code for video setup screen.
Matti Hamalainen <ccr@tnsp.org>
parents:
573
diff
changeset
|
240 |
593 | 241 int optVidWidth, optVidHeight, |
242 optVidDepth, optVFlags, | |
243 optVidAspect, optVidSetup; | |
578
cf5d44b36851
Add some initial code for video setup screen.
Matti Hamalainen <ccr@tnsp.org>
parents:
573
diff
changeset
|
244 |
cf5d44b36851
Add some initial code for video setup screen.
Matti Hamalainen <ccr@tnsp.org>
parents:
573
diff
changeset
|
245 int optResFlags; |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
246 char *optDataPath, *optPackFilename; |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
247 |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
248 #ifdef DM_USE_JSS |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
249 JSSMixer *dev; |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
250 JSSPlayer *plr; |
110
8db49a23b393
Fixes to make the JSS audio subsystem support work again in the engine framework.
Matti Hamalainen <ccr@tnsp.org>
parents:
105
diff
changeset
|
251 int jss_format; |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
252 #endif |
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
253 |
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
254 #ifdef DM_USE_TREMOR |
359
59045853853d
Make resource management re-entrant.
Matti Hamalainen <ccr@tnsp.org>
parents:
354
diff
changeset
|
255 DMResource *audioRes; |
113 | 256 size_t audioPos; |
105
d5d27f262227
Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
257 #endif |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
258 |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
259 int (*demoInit)(struct DMEngineData *); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
260 int (*demoInitPreVideo)(struct DMEngineData *); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
261 int (*demoInitPostVideo)(struct DMEngineData *); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
262 int (*demoRender)(struct DMEngineData *); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
263 void (*demoShutdown)(struct DMEngineData *); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
264 void (*demoQuit)(struct DMEngineData *); |
127
ab4086db7dad
Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents:
113
diff
changeset
|
265 |
622 | 266 // Setup specifics |
623 | 267 DMVector setupMenuPos, setupMenuDim, setupText1Pos; |
635
7092cd50bc08
Add condensed text configuration option to setup screen config.
Matti Hamalainen <ccr@tnsp.org>
parents:
623
diff
changeset
|
268 BOOL setupMenuCenter, setupTextCondensed; |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
269 } DMEngineData; |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
270 |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
271 |
382
371edff7dc3d
Fix extern variables to match what are actually declared in dmengine.c
Matti Hamalainen <ccr@tnsp.org>
parents:
375
diff
changeset
|
272 extern DMEffect *engineEffects; |
371edff7dc3d
Fix extern variables to match what are actually declared in dmengine.c
Matti Hamalainen <ccr@tnsp.org>
parents:
375
diff
changeset
|
273 extern int nengineEffects, nengineEffectsAlloc; |
368 | 274 |
275 | |
276 // Effect registration | |
277 int engineRegisterEffect(const DMEffect *ef); | |
371
56bd2693472f
Oops, the function prototypes were incorrect.
Matti Hamalainen <ccr@tnsp.org>
parents:
368
diff
changeset
|
278 int engineInitializeEffects(DMEngineData *); |
56bd2693472f
Oops, the function prototypes were incorrect.
Matti Hamalainen <ccr@tnsp.org>
parents:
368
diff
changeset
|
279 void engineShutdownEffects(DMEngineData *); |
368 | 280 DMEffect *engineFindEffect(const char *name, const int nparams); |
281 DMEffect *engineFindEffectByName(const char *name); | |
282 | |
283 | |
573
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
284 #ifdef DM_USE_TIMELINE |
368 | 285 // Basic timeline handling |
286 int dmLoadTimeline(DMResource *res, DMTimeline **tl); | |
287 void dmFreeTimeline(DMTimeline *tl); | |
288 | |
289 void dmFreeTimelinePoints(DMTimelinePoints *points); | |
290 void dmFreeTimelineEventParam(DMTimelineEventParam *param); | |
291 void dmFreeTimelineEvent(DMTimelineEvent *event); | |
292 void dmFreeTimelineTrack(DMTimelineTrack *track); | |
293 | |
294 | |
295 // Execution related | |
296 int dmPrepareTimeline(DMTimeline *tl, DMPreparedTimeline *ptl); | |
297 void dmFreePreparedTimelineData(DMPreparedTimeline *ptl); | |
298 | |
299 int dmSeekTimeline(DMPreparedTimeline *tl, int time); | |
300 int dmExecuteTimeline(DMPreparedTimeline *tl, SDL_Surface *screen, int time); | |
301 | |
302 | |
303 // Editing/saving related functions | |
395
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
304 int dmCopyTimelinePoints(const DMTimelinePoints *src, DMTimelinePoints *dst); |
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
305 int dmCopyTimelineEventParam(const DMTimelineEventParam *src, DMTimelineEventParam *dst); |
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
306 int dmCopyTimelineEvent(const DMTimelineEvent *src, DMTimelineEvent **pdst); |
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
307 int dmCopyTimelineCurve(const DMTimelineCurve *src, DMTimelineCurve *dst); |
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
308 int dmCopyTimelineTrack(const DMTimelineTrack *src, DMTimelineTrack **pdst); |
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
309 int dmCopyTimeline(const DMTimeline *src, DMTimeline **pdst); |
530db8fa4569
Implement functions for copying timelines and timeline components.
Matti Hamalainen <ccr@tnsp.org>
parents:
390
diff
changeset
|
310 |
368 | 311 int dmSaveTimeline(DMResource *res, DMTimeline *tl); |
312 | |
313 int dmTimelineNew(DMTimeline **tl, const char *name); | |
314 int dmTimelineAddTrack(DMTimeline *tl, DMTimelineTrack **track, const char *name); | |
315 int dmTimelineTrackAddEvent(DMTimelineTrack *track, int start, int duration, DMTimelineEvent **pev); | |
402
0f290af63fc1
Timeline event drawing prototype works.
Matti Hamalainen <ccr@tnsp.org>
parents:
395
diff
changeset
|
316 int dmTimelineEventSetEffect(DMTimelineEvent *event, DMEffect *ef); |
0f290af63fc1
Timeline event drawing prototype works.
Matti Hamalainen <ccr@tnsp.org>
parents:
395
diff
changeset
|
317 int dmTimelineEventSetEffectByIndex(DMTimelineEvent *event, const int index); |
0f290af63fc1
Timeline event drawing prototype works.
Matti Hamalainen <ccr@tnsp.org>
parents:
395
diff
changeset
|
318 int dmTimelineEventSetEffectByName(DMTimelineEvent *event, const char *name); |
368 | 319 |
573
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
320 #endif // DM_USE_TIMELINE |
14640d0688d3
Make timeline stuff optional.
Matti Hamalainen <ccr@tnsp.org>
parents:
564
diff
changeset
|
321 |
368 | 322 |
323 // Resource helpers | |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
324 #define engineGetResImage(eng, x, name) \ |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
325 do { \ |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
326 if ((x = (SDL_Surface *) engineGetResource(eng, name)) == NULL) \ |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
327 return DMERR_INIT_FAIL; \ |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
328 } while (0) |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
329 |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
330 #define engineGetResModule(eng, x, name) \ |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
331 do { \ |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
332 if ((x = (JSSModule *) engineGetResource(eng, name)) == NULL) \ |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
333 return DMERR_INIT_FAIL; \ |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
334 } while (0) |
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
335 |
367 | 336 #define engineFindResource(eng, name) dmres_find((eng)->resources, name) |
337 | |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
338 |
342
c6ec970dc3cf
Separate some demo engine parts to two different modules.
Matti Hamalainen <ccr@tnsp.org>
parents:
335
diff
changeset
|
339 int engineClassifier(DMResource *res); |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
340 void * engineGetResource(DMEngineData *eng, const char *name); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
341 int engineGetTime(DMEngineData *eng, int t); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
342 int engineGetTimeDTi(DMEngineData *eng); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
343 int engineGetTick(DMEngineData *eng); |
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
344 float engineGetTimeDT(DMEngineData *eng); |
368 | 345 |
593 | 346 int engineGetVideoAspect(int width, int height); |
347 | |
348 | |
368 | 349 // Implemented in actual demo code |
366
38e10b5f4e09
Work towards base engine re-entrancy.
Matti Hamalainen <ccr@tnsp.org>
parents:
361
diff
changeset
|
350 int demoPreInit(DMEngineData *eng); |
32
d1a6833a5d67
Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
351 |
317 | 352 |
353 #ifdef __cplusplus | |
354 } | |
355 #endif | |
356 | |
372 | 357 #endif // DMENGINE_H |