From 6839207f8c55ff1bdd19a2934eaad70343ea5530 Mon Sep 17 00:00:00 2001
From: Taha Belkhiri <belkhiri.taha53@gmail.com>
Date: Wed, 29 Jun 2022 15:15:18 +0200
Subject: [PATCH] changement texture ground

---
 .../jeu_appren_par_renfo/Res/ground.png       | Bin 0 -> 165 bytes
 .../jeu_appren_par_renfo/src/render.c         |  18 ++++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100644 travail_de_groupe/jeu_appren_par_renfo/Res/ground.png

diff --git a/travail_de_groupe/jeu_appren_par_renfo/Res/ground.png b/travail_de_groupe/jeu_appren_par_renfo/Res/ground.png
new file mode 100644
index 0000000000000000000000000000000000000000..aa4c67370c9320ccd51a38a984fb7fbea1b4c527
GIT binary patch
literal 165
zcmeAS@N?(olHy`uVBq!ia0y~yU<EQ68W@>@WZt5%(?E)`ILO_JVcj{Imp~3nx}&cn
z1H;CC?mvkjrOW|7A+8M57#b1<+<;up0*}aI1_r*vAk26?e?<yVP}|eRF{I+w+k=d}
nK;EGR-~Ds>*;#;0bTDT%V?YA~<8-6$S0E`*S3j3^P6<r_UgIR0

literal 0
HcmV?d00001

diff --git a/travail_de_groupe/jeu_appren_par_renfo/src/render.c b/travail_de_groupe/jeu_appren_par_renfo/src/render.c
index 9f4b0c1..14eebf7 100644
--- a/travail_de_groupe/jeu_appren_par_renfo/src/render.c
+++ b/travail_de_groupe/jeu_appren_par_renfo/src/render.c
@@ -18,6 +18,7 @@ SDL_Texture *crowdTexture;
 SDL_Texture *playerTexture;
 SDL_Texture *ballTexture;
 SDL_Texture *skyTexture;
+SDL_Texture *groundTexture;
 
 int **rays;
 int raysListLength = 0;
@@ -884,18 +885,22 @@ void drawBall()
 
 void drawSkyAndGround()
 {
-    SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
-    SDL_RenderFillRect(renderer, NULL);
+    destRect.x = ((int)( (player.angle+pi) * RD + player.x/BLOCK_SIZE));
+    destRect.y = 0;
+    destRect.w = 100;
+    destRect.h = 128/2;
+
+    rect.x = 0;
+    rect.y = screenDimension.h / 2 + player.viewAngle;
+    rect.h = screenDimension.h - rect.y;
+    rect.w = screenDimension.w;
+    SDL_RenderCopy(renderer, groundTexture, &destRect, &rect);
 
     sky.x = 0;
     sky.y = 0;
     sky.w = screenDimension.w;
     sky.h = screenDimension.h / 2 + player.viewAngle;
 
-    destRect.x = ((int)( (player.angle+pi) * RD + player.x/BLOCK_SIZE));
-    destRect.y = 0;
-    destRect.w = 100;
-    destRect.h = 128/2;
     SDL_RenderCopy(renderer, skyTexture, &destRect, &sky);
 
     SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
@@ -1043,6 +1048,7 @@ void mainLoop()
     netEdgeLeftTexture = loadTexture("Res/netLeft.png");
     netEdgeRightTexture = loadTexture("Res/netRight.png");
     skyTexture = loadTexture("Res/sky.png");
+    groundTexture = loadTexture("Res/ground.png");
 
     ray1 = malloc(sizeof(int) * 2);
     ray2 = malloc(sizeof(int) * 2);
-- 
GitLab