Skip to content
Snippets Groups Projects
Commit 416417da authored by belkhiritaha's avatar belkhiritaha
Browse files

ajout/affichage countdown

parent 172a77fb
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define STRONG 3 #define STRONG 3
#define SPREAD 4 #define SPREAD 4
#define UPDATETIME 5
typedef struct fire{ typedef struct fire{
......
...@@ -266,7 +266,7 @@ void drawTime(){ ...@@ -266,7 +266,7 @@ void drawTime(){
SDL_RenderCopy(renderer, scoreTexture, NULL, &rect); SDL_RenderCopy(renderer, scoreTexture, NULL, &rect);
rect.y += rect.h; rect.y += rect.h;
char str[10]; char str[10];
sprintf(str, "%d", (int)timer/1000); sprintf(str, "%d", UPDATETIME - (int)timer/1000 % UPDATETIME);
SDL_Color textColor = {237,222,17}; SDL_Color textColor = {237,222,17};
SDL_Surface * surface = TTF_RenderText_Solid(robotoFont, str, textColor); SDL_Surface * surface = TTF_RenderText_Solid(robotoFont, str, textColor);
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface); SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface);
...@@ -373,7 +373,7 @@ void mainLoop(){ ...@@ -373,7 +373,7 @@ void mainLoop(){
drawMenu(); drawMenu();
break; break;
case GAME: case GAME:
if ((int)timer/1000 % 5 == 0){ if ((int)timer/1000 % UPDATETIME == 0){
nextFire(fireList); nextFire(fireList);
} }
drawGame(); drawGame();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment