-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathShooterGame.h
73 lines (58 loc) · 1.86 KB
/
ShooterGame.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
73
// Copyright 2009 Isis Innovation Limited
//
// C++ Interface: ShooterGame
//
// Description: A simple AR game where the user has to shoot the sprouting targets.
//
//
// Author: Robert Castle <[email protected]>, (C) 2009
//
//
#ifndef SHOOTERGAME_H
#define SHOOTERGAME_H
#include "Game.h"
#include "ShooterGameTarget.h"
#include <list>
namespace PTAMM {
struct Bullet {
Vector<3> v3Position;
Vector<3> v3Direction;
double dVelocity;
int nStrength;
int nDamage;
Bullet() : dVelocity(0.01), nStrength(100), nDamage(20) {}
};
/**
* A simple AR game where targets sprout from random map points and the user
* has to aim the camera to shot them.
* @author Robert Castle <[email protected]>
*/
class ShooterGame : public Game
{
public:
ShooterGame();
~ShooterGame();
void Draw3D( const GLWindow2 &glWindow, Map &map, SE3<> se3CfromW);
void Draw2D( const GLWindow2 &glWindow, Map &map);
void Reset();
void Init();
void HandleKeyPress( std::string sKey );
void Advance();
std::string Save( std::string sMapPath );
void Load( std::string sDataFileName );
private:
void _ResetGameState();
void _CreateInitialTargets();
private:
Map * mpMap; // The associated map
SE3<> mse3CfW; // The camera postion
GLuint mnSphereDisplayList; // The sphere display list
std::list< ShooterGameTarget * > mTargets; // The list of targets
std::list< Bullet > mBullets; // The list of bullets
int mnScore; // The player's score
int mnHealth; // The player's health
bool mbAlive; // Is the player alive
const double mdVersion; // Current game version
};
}
#endif