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