-
Notifications
You must be signed in to change notification settings - Fork 1
/
CWorld.h
executable file
·59 lines (43 loc) · 1.4 KB
/
CWorld.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
//
// Class to represent our world: just a missile and a target for it to
// steer towards
//
#ifndef CWORLD_H
#define CWORLD_H
#include "CMissile.h"
#include "CTarget.h"
#include "Texture.h"
class CGlView;
// List of all of the keys that we're interested in
enum eKey
{
eKEY_MISSILE_THRUST = 0,
eKEY_MISSILE_TURN_LEFT,
eKEY_MISSILE_TURN_RIGHT,
eKEY_TARGET_MOVE_LEFT,
eKEY_TARGET_MOVE_RIGHT,
eKEY_TARGET_MOVE_UP,
eKEY_TARGET_MOVE_DOWN,
NUM_KEYS,
};
class CWorld
{
public:
CWorld();
~CWorld();
void BeginTimestep();
void DoTimestep(float timestep);
void EndTimestep();
void HandleKeyboardState(eKey key, bool state);
float GetSize();
CVector2* GetCenter();
CMissile* GetMissile() { return &m_Missile; }
CTarget* GetTarget() { return &m_Target; }
int Draw(CGlView *gl_view);
private:
void ResetMissileAndTarget();
CVector2 m_Center; // Location of the center of our world
CMissile m_Missile; // Our missile
CTarget m_Target; // The target the missile is steering towards
};
#endif