ajout de classe carte
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
enum class Element {
|
||||||
|
SOL,
|
||||||
|
MUR,
|
||||||
|
};
|
||||||
|
|
||||||
|
class Carte {
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string _titre;
|
||||||
|
std::string _auteur;
|
||||||
|
std::string _description;
|
||||||
|
std::vector<std::vector<int>> _tiles;
|
||||||
|
public:
|
||||||
|
Carte(): _titre("Titre"), _auteur("Auteur"), _description("Description"){std::cout << "carte crée\n";}
|
||||||
|
virtual ~Carte(){std::cout << "carte détruite\n";}
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "Carte_Basique.hpp"
|
||||||
|
|
||||||
|
Carte_Basique::Carte_Basique()
|
||||||
|
: titre("Carte Basique"), auteur("nullEd"), description("Description de la carte basique") {
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
if (i == 0 || i == 9) {
|
||||||
|
std::vector<int> row(10, static_cast<int>(Element::MUR));
|
||||||
|
tiles.push_back(row);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (i % 2 == 0) {
|
||||||
|
std::vector <int> row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "Carte Basique créée\n";
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include "Carte.hpp"
|
||||||
|
|
||||||
|
class Carte_Basique : public Carte {
|
||||||
|
|
||||||
|
public:
|
||||||
|
Carte_Basique();
|
||||||
|
~Carte_Basique();
|
||||||
|
};
|
||||||
@@ -7,9 +7,11 @@ LDFLAGS = -lSDL2
|
|||||||
SRC = main.cpp \
|
SRC = main.cpp \
|
||||||
Bomberman.cpp \
|
Bomberman.cpp \
|
||||||
Game.cpp \
|
Game.cpp \
|
||||||
|
Carte_Basique.cpp \
|
||||||
|
|
||||||
DEPS = Bomberman.hpp \
|
DEPS = Bomberman.hpp \
|
||||||
Game.hpp \
|
Game.hpp \
|
||||||
|
Carte.hpp \
|
||||||
|
|
||||||
OBJ = $(SRC:.cpp=.o)
|
OBJ = $(SRC:.cpp=.o)
|
||||||
|
|
||||||
@@ -25,6 +27,7 @@ all: $(NAME)
|
|||||||
clean:
|
clean:
|
||||||
rm -f $(OBJ)
|
rm -f $(OBJ)
|
||||||
rm -f Bomberman.hpp.gch
|
rm -f Bomberman.hpp.gch
|
||||||
|
rm -f Carte.hpp.gch
|
||||||
rm -f Game.hpp.gch
|
rm -f Game.hpp.gch
|
||||||
fclean: clean
|
fclean: clean
|
||||||
rm -f $(NAME)
|
rm -f $(NAME)
|
||||||
|
|||||||
Reference in New Issue
Block a user