summaryrefslogtreecommitdiff
path: root/src/game.h
blob: 943ed63ddefd9286b69f770f1a08781694899f44 (plain)
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
/*********************************************************************
 * File: game.h
 * Description: Defines the game class for Asteroids
 *
 *********************************************************************/

#ifndef GAME_H
#define GAME_H

#include <vector>
#include "bullet.h"
#include "ship.h"
#include "rocks.h"
#include "uiDraw.h"
#include "uiInteract.h"

#define CLOSE_ENOUGH 15

using namespace std;

class Game
{
private:
    Point topLeft;
    Point bottomRight;
    vector<Rock *> rocks;
    vector<Bullet *> bullets;
    Ship* ship;
	int level = 0;

    float getClosestDistance( const FlyingObject &obj1 , const FlyingObject &obj2 ) const;

    vector<Rock *> createRocks();

    void advanceBullets();
    void advanceAsteroids();
    void advanceShip();

    void cleanUpZombies();

    void handleCollisions();

    void drawBullets();
    void drawRocks();
    void drawShip();
public:
    Game ( const Point &tl , const Point &br );
    void handleInput ( const Interface &ui );
    void draw ( const Interface &ui );
    void advance();
};


#endif /* GAME_H */