annotate dmsimple.h @ 317:adb101296bb8

Add C++ protectors.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 14 Oct 2012 00:17:21 +0300
parents f7b449811403
children 47381d8e130c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #ifndef DMSIMPLE_H
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 #define DMSIMPLE_H
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"
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
105
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
9 #ifdef DM_USE_JSS
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #include "jss.h"
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #include "jssmod.h"
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #include "jssmix.h"
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 #include "jssplr.h"
105
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
14 #endif
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
317
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
17 #ifdef __cplusplus
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
18 extern "C" {
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
19 #endif
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
20
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
21
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 typedef struct
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 {
93
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
24 int currFrame, endTime, startTime,
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
25 totalFrameTime, adjustTime, pauseTime;
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
26
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
27 BOOL pauseFlag, paused, exitFlag;
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 SDL_Surface *screen;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 SDL_Event event;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
105
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
31 SDL_AudioSpec optAfmt;
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
32 int optScrWidth, optScrHeight, optVFlags, optBitDepth, optResFlags;
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
33 char *optDataPath, *optPackFilename;
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
105
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
35 #ifdef DM_USE_JSS
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 JSSMixer *dev;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 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
38 int jss_format;
105
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
39 #endif
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
40
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
41 #ifdef DM_USE_TREMOR
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
42 DMResource *audio;
113
34ccf783ecca Fix some warnings.
Matti Hamalainen <ccr@tnsp.org>
parents: 110
diff changeset
43 size_t audioPos;
105
d5d27f262227 Beging merging of dmsimple2-fork into the main "engine".
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
44 #endif
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
93
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
46 #ifdef DM_DEBUG
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
47 BOOL optDebug;
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
48 Uint8 *audioBuf;
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
49 int audioBufSize;
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
50 int audioSamples;
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
51 int demoDuration;
15fdd5573344 Add simple (and buggy / not really working) debug mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
52 #endif
127
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
53
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
54 int (*demoInit)();
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
55 int (*demoInitPreVideo)();
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
56 int (*demoInitPostVideo)();
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
57 int (*demoRender)();
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
58 void (*demoShutdown)();
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
59 void (*demoQuit)();
ab4086db7dad Various improvements in modularity.
Matti Hamalainen <ccr@tnsp.org>
parents: 113
diff changeset
60
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 } DMEngineData;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 typedef struct
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 {
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 int currFrame, endTime, startTime;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 } DMFrameData;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
311
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
70 typedef struct
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
71 {
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
72 void * data;
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
73 int (*init)(void **data);
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
74 void (*shutdown)(void *data);
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
75 int (*render)(void *data, int t);
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
76 } DMEffect;
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
77
f7b449811403 Add extremely simplistic struct for effects.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
78
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 extern DMEngineData engine;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 extern DMFrameData frame;
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 #define engineGetResImage(x, name) \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 do { \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 if ((x = (SDL_Surface *) engineGetResource(name)) == NULL) \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 return DMERR_INIT_FAIL; \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 } while (0)
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 #define engineGetResModule(x, name) \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 do { \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 if ((x = (JSSModule *) engineGetResource(name)) == NULL) \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 return DMERR_INIT_FAIL; \
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 } while (0)
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 void * engineGetResource(const char *name);
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 int engineGetTime(int t);
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 int engineGetTimeDTi();
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 int engineGetTick();
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 float engineGetTimeDT();
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 int demoPreInit();
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
317
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
104
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
105 #ifdef __cplusplus
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
106 }
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
107 #endif
adb101296bb8 Add C++ protectors.
Matti Hamalainen <ccr@tnsp.org>
parents: 311
diff changeset
108
32
d1a6833a5d67 Added a simple demo engine core.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 #endif // DMSIMPLE_H