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 Binary files /dev/null and b/travail_de_groupe/jeu_appren_par_renfo/Res/ground.png differ 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 9f4b0c17707ed18a1868f9dddc6d46f43a54a0bc..14eebf743f7f0b2a6149d372b2259850ba6bd21a 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);