-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.hpp
53 lines (42 loc) · 1.35 KB
/
Map.hpp
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
#ifndef MAP_HPP_INCLUDED
#define MAP_HPP_INCLUDED
#include "IA/Pathfinding.hpp"
#include "Tank.hpp"
#include "Barrel.hpp"
#include "Tree.hpp"
#include <iostream>
#include <cstdlib>
#define uint unsigned int
constexpr unsigned int map_width(30);
constexpr unsigned int map_height(30);
constexpr unsigned int total_tiles(map_width * map_height);
struct PuddleOfOil
{
Barrel barrel;
sf::Sprite oil;
};
class Map
{
private:
Loader<sf::Texture>& textureLoader;
sf::Sprite tiles[total_tiles];
std::vector<Barrel> borders;
std::vector<Barrel> barrels;
std::vector<PuddleOfOil> puddleOfOils;
std::vector<Tree> forest;
void create_puddleOfOil(float x, float y); //Créer une flaque d'huile aux coordonnées
void create_barrel(float x, float y); //Créer un baril aux coordonnées
void create_forest(float x, float y, uint number_of_tree); //Créer une forêt avec un nombre d'arbre prédéterminé
void create_scheme(); //Create a sheme for the pathfinding
public:
Map(Loader<sf::Texture>& tM);
~Map();
void create();
//Gère les collisions avec le décor
bool handle_collision(Object& object, float dt);
//Affiche les éléments en dessous des chars
void draw_below(sf::RenderWindow& window);
//Affiche les éléments au dessus des chars
void draw_above(sf::RenderWindow& window);
};
#endif // MAP_HPP_INCLUDED