1 /*
2 * This code is released under the GNU General Public License.  See COPYING for
3 * details.  Copyright 2003 John Spray: spray_john@users.sourceforge.net
4 */
5 
6 
7 
8 #ifndef CAMERA_H
9 #define CAMERA_H
10 
11 #include <SDL_ttf.h>
12 #include <string>
13 using namespace std;
14 
15 #include "Player.h"
16 #include "Vector.h"
17 #include "Arena.h"
18 #include "Ufo.h"
19 #include "Obstacle.h"
20 #include "PowerUp.h"
21 #include "Mine.h"
22 
23 //not include the Visual header because that would be a mutual include
24 class Visual;
25 
26 
27 enum CameraMoveMode{
28         /*
29 	 * 0 - camera free - orientation changed by bearv/pitchv/rollv,
30 	 * 	these and position to be set externally of AnimateCamera
31 	 * 1 - chasecam - 3rd person view of player
32 	 * 2 - closeup - closely bound 3rd person view from player,
33 	 * 	just outside fuselage, facing forward
34 	 * 3 - god's eye - view from some 100-200 above the player,
35 	 * 	directly down, view rotating with player's bearing
36 	 * 4 - rearview - view from rear of player
37 	*/
38 	CAMERA_MOVEMODE_FREE=0,
39 	CAMERA_MOVEMODE_CHASE=1,
40 	CAMERA_MOVEMODE_CLOSE=2,
41 	CAMERA_MOVEMODE_GOD=3,
42 	CAMERA_MOVEMODE_REAR=4
43 };
44 
45 class Camera{
46 
47 public:
48 	Camera();
49 	~Camera();
50 	void Animate();
51 	void Draw();
52 	void DrawPlayer(Player* player);
53 	void DrawGrid();
54 	void DrawArena(Arena* arena);
55 	void DrawSky();
56 	void DrawAxisSprite(Vector p1,Vector p2,float radius);
57 	void DrawSprite(Vector s_sprite,float radius,float spin);
58 	void DrawMissiles();
59 	void DrawUfo(Ufo* ufo);
60 	void DrawMine(Mine* mine);
61 	void DrawPowerUp(PowerUp* powerup);
62 	void DrawObstacle(Obstacle* obstacle);
63 	void SetMessage(string);
64 	Player* targetplayer;
65   void DrawParticles();
66 	Visual* visual;
67   void Draw2D();
68 	Vector s;
69 	Vector v;
70 	Vector a;
71 	Vector face;
72 	Vector up;
73 
74 	float bear; //RADIANS!
75 	float pitch; //RADIANS!
76 	float roll; //RADIANS
77 	float bearv;
78 	float pitchv;
79 	float rollv;
80 
81 	float offset;
82 
83 	int viewportx;
84 	int viewporty;
85 	int viewportwidth;
86 	int viewportheight;
87 	float fov;
88 	float farclip;
89 	float nearclip;
90 
91 	int movemode;
92 
93 	TTF_Font* scorefont;
94 	string message;
95 	float messagetimer;
96 	float messagetimermax;
97 };
98 
99 #endif // CAMERA_H
100