summary refs log tree commit diff
path: root/src/misc.h
blob: 36880ffc74a8e0f49a29e20cf193a86c6695915f (plain) (blame)
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
#ifndef BLACKSHADES_MISC_H
#define BLACKSHADES_MISC_H

#include <stdbool.h>
#include <stddef.h>

#include <AL/al.h>
#include <GL/gl.h>

struct AnimationData {
	struct {
		struct { float x, y, z; } joints[20];
		float speed;
	} *ptr;
	size_t len;
};

struct JointData {
	float x, y, z;
	float length;
	unsigned char model;
	bool visible;
	bool lower;
	signed char parent;
};

struct ModelData {
	struct {
		struct { float x, y, z; } *ptr;
		size_t len;
	} vertices;
	struct {
		struct {
			short v[3];
			float r, g, b;
		} *ptr;
		size_t len;
	} faces;
};

struct MuscleData {
	float length, initlen, minlen, maxlen;
	bool flag;
	bool visible;
	signed char parent1;
	signed char parent2;
};

struct Scores {
	size_t high_score;
	bool completed;
};

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
	bool keyPress(int key);
	struct AnimationData loadAnimation(const char*);
	void loadJoints(struct JointData*);
	struct ModelData loadModel(const char*);
	void loadMuscles(struct MuscleData*);
	ALuint loadSound(const char*);
	GLuint loadTexture(const char*);
	void playSound(ALuint source, ALfloat x, ALfloat y, ALfloat z);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

#endif // BLACKSHADES_MISC_H