diff --git a/travail_de_groupe/chef_oeuvre/markov.txt b/travail_de_groupe/chef_oeuvre/markov.txt index 4c18679d32b93424c3e4f46eebd8ecb1a43df08a..7b171fb51e70fa70daefd7e3690c285531fb7a75 100644 --- a/travail_de_groupe/chef_oeuvre/markov.txt +++ b/travail_de_groupe/chef_oeuvre/markov.txt @@ -1,5 +1,5 @@ 50 50 0 0 0 -0 60 40 0 0 -0 10 70 20 0 -0 0 10 50 40 +0 30 70 0 0 +0 10 50 40 0 +0 0 10 40 50 0 0 0 50 50 diff --git a/travail_de_groupe/chef_oeuvre/src/render.c b/travail_de_groupe/chef_oeuvre/src/render.c index f8facc890762b2fb7518567a71171a9f3af29858..0e31c3aadd8555696ecfd26fbc7ef6a67469c965 100644 --- a/travail_de_groupe/chef_oeuvre/src/render.c +++ b/travail_de_groupe/chef_oeuvre/src/render.c @@ -143,7 +143,7 @@ void endSDL(){ TTF_CloseFont(robotoFont); TTF_Quit(); SDL_Quit(); - if (!fireList){ + if (gameState != WON){ fireList = freeListFire(fireList); } } @@ -404,7 +404,6 @@ void drawLost(){ SDL_RenderCopy(renderer, playAgainButtonHoverTexture, NULL, &rect); SDL_RenderCopy(renderer, quitButtonHoverTexture, NULL, &rect); SDL_RenderCopy(renderer, playAgainButtonHoverTexture, NULL, &rect); - SDL_RenderPresent(renderer); // draw score rect.h = screenDimension.h/12; @@ -417,6 +416,7 @@ void drawLost(){ SDL_Surface * surface = TTF_RenderText_Solid(robotoFont, str, textColor); SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface); SDL_RenderCopy(renderer, texture, NULL, &rect); + SDL_RenderPresent(renderer); } void drawWon(){ @@ -429,6 +429,18 @@ void drawWon(){ SDL_RenderCopy(renderer, playAgainButtonHoverTexture, NULL, &rect); SDL_RenderCopy(renderer, quitButtonHoverTexture, NULL, &rect); SDL_RenderCopy(renderer, playAgainButtonHoverTexture, NULL, &rect); + + // draw score + rect.h = screenDimension.h/12; + rect.w = rect.h; + rect.x = screenDimension.w/2; + rect.y = screenDimension.h/2 - rect.h; + char str[10]; + sprintf(str, "%d", player.score); + SDL_Color textColor = {237,222,17}; + SDL_Surface * surface = TTF_RenderText_Solid(robotoFont, str, textColor); + SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface); + SDL_RenderCopy(renderer, texture, NULL, &rect); SDL_RenderPresent(renderer); }