-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scripting.h
executable file
·72 lines (52 loc) · 1.6 KB
/
Scripting.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
//**********************************************************************
//
// File: Scripting.h
// Programmer: T.J. Eason
// Project: Game Engine
// Description: Scripting system
// Date: 2-3-10
// Revision 1: 3-23-10
// Revision 2: 3-24-10
// Revision 3: 3-25-10
//
// **********************************************************************
#ifndef SCRIPTING_H
#define SCRIPTING_H
// Variable enumerations
enum { VARIABLE_BOOL, VARIABLE_COLOR, VARIABLE_FLOAT, VARIABLE_NUMBER, VARIABLE_STRING,
VARIABLE_VECTOR, VARIABLE_UNKNOWN };
// Variable class
class Variable
{
public:
Variable( char *name, FILE *file );
Variable( char *name, char type, void *value );
virtual ~Variable();
char GetType();
char *GetName();
void *GetData();
private:
char m_type; // Type of data stored in a variable
char *m_name; // Variable name
void *m_data; // Data stored in variable
};
// Script class
class Script : public Resource< Script >
{
public:
Script( char *name, char *path = "./" );
virtual ~Script();
void AddVariable( char *name, char type, void *value );
void SetVariable( char *name, void *value );
void SaveScript( char *filename = NULL );
bool *GetBoolData( char *variable );
D3DCOLORVALUE *GetColorData( char *variable );
float *GetFloatData( char *variable );
long *GetNumberData( char *variable );
char *GetStringData( char *variable );
D3DXVECTOR3 *GetVectorData( char *variable );
void *GetUnknownData( char *variable );
private:
LinkedList< Variable > *m_variables; // Linked list of variables from a script
};
#endif