-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
75 lines (62 loc) · 2.08 KB
/
game.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
74
75
/*************************************************************
* File: game.h
* Description: Contains the definition of the game class.
*************************************************************/
#ifndef GAME_H
#define GAME_H
#include "uiDraw.h"
#include "uiInteract.h"
#include "point.h"
#include "ground.h"
#include "lander.h"
#define FUEL 500 // initial fuel for the game
#define MIN_SPEED 3.0 // minimal landing speed
#define FALL_HEIGHT 4.0 // greatest height we can fall from
#define GRAVITY_AMOUNT 0.1
/*****************************************
* GAME
* The main game class containing all the state
*****************************************/
class Game
{
public:
/*********************************************
* Constructor
* Initializes the game
*********************************************/
Game(Point tl, Point br) : topLeft(tl), bottomRight(br), ground(Ground(topLeft, bottomRight))
{
// Set up the initial conditions of the game
lander.setFuel(FUEL);
}
/*********************************************
* Function: handleInput
* Description: Takes actions according to whatever
* keys the user has pressed.
*********************************************/
void handleInput(const Interface & ui);
/*********************************************
* Function: advance
* Description: Move everything forward one
* step in time.
*********************************************/
void advance();
/*********************************************
* Function: draw
* Description: draws everything for the game.
*********************************************/
void draw(const Interface & ui);
private:
/*********************************************
* Function: justLanded
* Description: Returns true if the lander has
* just successfully landed.
*********************************************/
bool justLanded() const;
// The coordinates of the screen
Point topLeft;
Point bottomRight;
Ground ground;
Lander lander;
};
#endif /* GAME_H */