From 6d64db049ea5755efb9a0123e6d91cb3de060b0e Mon Sep 17 00:00:00 2001 From: belkhiritaha <belkhiri.taha53@gmail.com> Date: Thu, 23 Jun 2022 14:29:00 +0200 Subject: [PATCH] fix clock --- travail_de_groupe/chef_oeuvre/src/fire.c | 4 ---- travail_de_groupe/chef_oeuvre/src/render.c | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/travail_de_groupe/chef_oeuvre/src/fire.c b/travail_de_groupe/chef_oeuvre/src/fire.c index 05377df..6f66819 100644 --- a/travail_de_groupe/chef_oeuvre/src/fire.c +++ b/travail_de_groupe/chef_oeuvre/src/fire.c @@ -55,10 +55,6 @@ listchainfire_t startFire(listchainfire_t listFire,int numberFire, int mapSize){ xFire= rand()%mapSize; yFire= rand()%mapSize; -<<<<<<< HEAD - //printf("xf:%d,yf:%d\n",xFire,yFire); -======= ->>>>>>> 91e99d9a0e864cf399133d4e59d4d7951d1bbd0a fire.x= xFire; fire.y= yFire; fire.state=1; diff --git a/travail_de_groupe/chef_oeuvre/src/render.c b/travail_de_groupe/chef_oeuvre/src/render.c index 21dda84..2c3a2ad 100644 --- a/travail_de_groupe/chef_oeuvre/src/render.c +++ b/travail_de_groupe/chef_oeuvre/src/render.c @@ -285,7 +285,8 @@ void drawTime(){ SDL_RenderCopy(renderer, scoreTexture, NULL, &rect); rect.y += rect.h; char str[10]; - sprintf(str, "%d", UPDATETIME - (int)timer/1000 % UPDATETIME); + printf("%d\n", (UPDATETIME * 2000 - (int)timer % (UPDATETIME * 2000))/1000); + sprintf(str, "%d", (UPDATETIME * 2000 - (int)timer % (UPDATETIME * 2000))/1000); SDL_Color textColor = {237,222,17}; SDL_Surface * surface = TTF_RenderText_Solid(robotoFont, str, textColor); SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface); @@ -385,17 +386,14 @@ void mainLoop(){ delta = (a - b); if (delta > 1000/FPS_TO_GET){ timer += delta; + printf("%d\n", (int)timer % 1000); b = a; -<<<<<<< HEAD - //printf("fps : %f", 1000/delta); -======= ->>>>>>> 91e99d9a0e864cf399133d4e59d4d7951d1bbd0a switch (gameState){ case MENU: drawMenu(); break; case GAME: - if ((int)timer % 100 == 0){ + if ((int)timer % (UPDATETIME * 2000) < 10){ nextFire(fireList); fireList=spreadFire(fireList); } -- GitLab