aboutsummaryrefslogtreecommitdiff
path: root/hgehelp/resources.h
blob: 8be838435efe38ace71948476aff38117d595c48 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
** Haaf's Game Engine 1.7
** Copyright (C) 2003-2007, Relish Games
** hge.relishgames.com
**
** hgeResourceManager resources header
*/

#ifndef HGERESOURCES_H
#define HGERESOURCES_H


#include "hgeresource.h"
#include "parser.h"


#define RES_SCRIPT		0

#define RES_RESOURCE	1
#define RES_TEXTURE		2
#define RES_EFFECT		3
#define RES_MUSIC		4
#define RES_STREAM		5
#define RES_TARGET		6
#define RES_SPRITE		7
#define RES_ANIMATION	8
#define RES_FONT		9
#define RES_PARTICLE	10
#define RES_DISTORT		11
#define RES_STRTABLE	12


void		AddRes(hgeResourceManager *rm, int type, ResDesc *resource);
ResDesc*	FindRes(hgeResourceManager *rm, int type, const char *name);


struct RScript : public ResDesc
{
	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm) {return 0;}
	virtual void  Free() {}
};

struct RResource : public ResDesc
{
	char		  filename[MAXRESCHARS];

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RTexture : public ResDesc
{
	char		  filename[MAXRESCHARS];
	bool		  mipmap;

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct REffect : public ResDesc
{
	char		  filename[MAXRESCHARS];

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RTarget : public ResDesc
{
	int			width;
	int			height;
	bool		zbuffer;

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RSprite : public ResDesc
{
	char		texname[MAXRESCHARS];
	float		tx, ty, w, h;
	float		hotx, hoty;
	int			blend;
	DWORD		color;
	float		z;
	bool		bXFlip, bYFlip;
//	float		x,y;
//	float		scale;
//	float		rotation;
//	int			collision;

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RAnimation : public RSprite
{
	int			frames;
	float		fps;
	int			mode;

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RFont : public ResDesc
{
	char		filename[MAXRESCHARS];
	bool		mipmap;
	int			blend;
	DWORD		color;
	float		z;
	float		scale;
	float		proportion;
	float		tracking;
	float		spacing;
	float		rotation;

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RParticle : public ResDesc
{
	char		filename[MAXRESCHARS];
	char		spritename[MAXRESCHARS];

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

struct RDistort : public ResDesc
{
	char		texname[MAXRESCHARS];
	float		tx, ty, w, h;
	int			cols, rows;
	int			blend;
	DWORD		color;
	float		z;

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};


struct RStringTable : public ResDesc
{
	char		  filename[MAXRESCHARS];

	static  void  Parse(hgeResourceManager *rm, RScriptParser *sp, const char *name, const char *basename);
	virtual DWORD Get(hgeResourceManager *rm);
	virtual void  Free();
};

#endif