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