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