Ajout de carte basique en binaire

This commit is contained in:
YANNIS
2025-05-31 16:08:45 +02:00
parent cfe9fc856a
commit 3b05a7e4e9
3 changed files with 17 additions and 9 deletions
+12 -8
View File
@@ -5,23 +5,27 @@ Carte_Basique::Carte_Basique() {
_titre = "Carte Basique"; _titre = "Carte Basique";
_auteur = "nullEd"; _auteur = "nullEd";
_description = "Description de la carte basique"; _description = "Description de la carte basique";
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 11; ++i) {
if (i == 0 || i == 9) { if (i == 0 || i == 10) {
std::vector<int> row(10, static_cast<int>(Element::MUR)); std::vector<int> row(11, static_cast<int>(Element::MUR));
_tiles.push_back(row); _tiles.push_back(row);
break;
} }
else if (i % 2 == 1) { else if (i % 2 == 0) {
std::vector <int> row; std::vector <int> row;
for (int j = 0; j < 10; ++j) { for (int j = 0; j < 11; ++j) {
if (j % 2 == 0) if (j == 0 || j == 10)
row.push_back(static_cast<int>(Element::MUR));
else if (j % 2 == 0)
row.push_back(static_cast<int>(Element::MUR)); row.push_back(static_cast<int>(Element::MUR));
else else
row.push_back(static_cast<int>(Element::SOL)); row.push_back(static_cast<int>(Element::SOL));
} }
_tiles.push_back(row);
} }
else { else {
std::vector<int> row(10, static_cast<int>(Element::SOL)); std::vector<int> row(11, static_cast<int>(Element::SOL));
row[0] = static_cast<int>(Element::MUR);
row[10] = static_cast<int>(Element::MUR);
_tiles.push_back(row); _tiles.push_back(row);
} }
} }
+4 -1
View File
@@ -38,6 +38,9 @@ Game::~Game() {
} }
void Game::Run() { void Game::Run() {
Carte_Basique carte;
std::cout << carte << std::endl;
//Main game loop
while (_isRunning) { while (_isRunning) {
//Handle events //Handle events
while (SDL_PollEvent(&_event)) { while (SDL_PollEvent(&_event)) {
@@ -51,7 +54,7 @@ void Game::Run() {
SDL_RenderClear(_renderer); SDL_RenderClear(_renderer);
//Render game objects here //Render game objects here
//Update the screen //Update the screen
SDL_RenderPresent(_renderer); SDL_RenderPresent(_renderer);
} }
+1
View File
@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <iostream> #include <iostream>
#include "Carte_Basique.hpp"
class Game { class Game {
private: private: