]> git.jsancho.org Git - lugaru.git/blob - Source/Sprite.h
7f25a8425e386f3623c7ef4c8f3238b447bdfe34
[lugaru.git] / Source / Sprite.h
1 /*
2 Copyright (C) 2003, 2010 - Wolfire Games
3
4 This file is part of Lugaru.
5
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
14
15 See the GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21
22 #ifndef _SPRITE_H_
23 #define _SPRITE_H_
24
25 #include "Quaternions.h"
26 #include "gamegl.h"
27 #include "TGALoader.h"
28 #include "Quaternions.h"
29 #include "Frustum.h"
30 #include "Lights.h"
31 #include "Terrain.h"
32 #include "Objects.h"
33
34 #include <vector>
35
36 #define max_sprites 20000
37
38 enum {
39         cloudsprite = 0,
40         bloodsprite,
41         flamesprite,
42         smoketype,
43         weaponflamesprite,
44         cloudimpactsprite,
45         snowsprite,
46         weaponshinesprite,
47         bloodflamesprite,
48         breathsprite,
49         splintersprite,
50         spritenumber
51 };
52
53 class Sprite{
54         private:
55                 XYZ oldposition;
56                 XYZ position;
57                 XYZ velocity;
58                 float size;
59                 float initialsize;
60                 int type;
61                 int special;
62                 float color[3];
63                 float opacity;
64                 float rotation;
65                 float alivetime;
66                 float speed;
67                 float rotatespeed;
68                 
69                 static float checkdelay;
70         
71                 static vector<Sprite*> sprites;
72         
73         public:
74                 static void DeleteSprite(int which);
75                 static void MakeSprite(int atype, XYZ where, XYZ avelocity, float red, float green, float blue, float asize, float aopacity);
76                 static void Draw();
77                 static void deleteSprites() {
78                         sprites.clear();
79                 }
80                 static void setLastSpriteSpecial(int s) {
81                         sprites.back()->special = s;
82                 }
83                 static void setLastSpriteSpeed(int s) {
84                         sprites.back()->speed = s;
85                 }
86                 static void setLastSpriteAlivetime(float al) {
87                         sprites.back()->alivetime = al;
88                 }
89                 static void clearTextures();
90                 
91                 static GLuint cloudtexture;
92                 static GLuint bloodtexture;
93                 static GLuint flametexture;
94                 static GLuint smoketexture;
95                 
96                 static GLuint cloudimpacttexture;
97                 static GLuint snowflaketexture;
98                 static GLuint shinetexture;
99                 static GLuint bloodflametexture;
100                 
101                 static GLuint splintertexture;
102                 
103                 static GLuint leaftexture;
104                 static GLuint toothtexture;
105
106                 Sprite();
107                 ~Sprite();
108 };
109
110 #endif