-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatatypes.h
79 lines (63 loc) · 2.12 KB
/
datatypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//Common Datatypes used in this project.
#ifndef DATATYPES_H
#define DATATYPES_H
#include <sndfile.h>
#include <portaudio.h>
/* Generally useful structs. */
typedef struct {
int x;
int y;
} vec2;
typedef struct {
int x;
int y;
int z;
} vec3;
/* Datatypes for ASCII display */
// Struct contains information about an ASCII Text Entity Descriptor
typedef struct {
//note that none of the following are null terminated
//as NULL (zero byte) may be a valid character
char* symbols; //characters
char* hitmap; //hitmap
char* colormap;//colors
vec2 center; //center of block for positioning
char* name; //name of state
} ated_state;
typedef struct {
short r;
short g;
short b;
} color;
typedef struct {
char* display; //in game display name
char* description; //description (for dev/debug)
char* name; //in code name
short id; //unique identifier
short columns; //number of columns
short rows; //number of rows
int block; //convienience variable for rows*columns
ated_state* states; //pointer to array of states
short num_states; //number of states
color colors[255]; //array of colors used by entity
char colormap[256]; //colormap, each char goes to a color
} ated;
typedef struct {
char* text; //not null terminated
int length; //number of chars
int position; //current position in buffer
} rstring;
/* Datatypes for use with PortAudio and LibSNDfile */
// Struct contians information about some audio data to be played.
typedef struct{
SNDFILE *sndFile, *injFile; // (Experimental) Secondary audio file to be played overtop the primary
SF_INFO sfInfo, injInfo; // Information about the audio file to be played
volatile char* filepath; // Filepath to audio to be played.
volatile int inject_audio; // (Experimental) Flag whether or not we are injecting audio
int position; // Index into audio file
volatile double volume;
volatile double deltavol; // Portaudio docs suggest that gradually changing the volume may fix the pops.
volatile int volch; // Flag to see if volume is changing.
volatile int thread_complete; // Simple semaphore to show the audio thread is finished.
} adata_t;
#endif