delay add for update and time add in game

This commit is contained in:
2024-12-15 22:29:29 +01:00
parent 6a1331623e
commit 9c9ece6a79
4 changed files with 65 additions and 37 deletions

8
main.c
View File

@@ -5,7 +5,6 @@
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_render.h>
#include <stdio.h>
#include <time.h>
#define SIZE_PLAY 19
#define SIZE_MENU 200;
@@ -24,21 +23,14 @@ int main ()
score playerScore;
unsigned short int **tab2d = creatArea2D (SIZE_PLAY);
playerScore.before = time (NULL);
targets
= fileToTab2D ("test.txt", tab2d, SIZE_PLAY, playerPos, &nbr_targets);
screenDisplayGameSDL (tab2d, &display_user);
vect size = {display_user.size_menu , display_user.size_window / 3};
vect pos = {0, display_user.size_window - display_user.size_menu};
displayTextSDL(&display_user, "Time 20:4345999", pos, size, 69);
screenDisplay (tab2d, SIZE_PLAY);
inGameLoop (tab2d, SIZE_PLAY, playerPos, targets, nbr_targets,
&display_user);
playerScore.after = time (NULL);
printf ("%ld\n", playerScore.after - playerScore.before);
SDL_DestroyWindow (display_user.window);
SDL_DestroyRenderer (display_user.renderer);
free2D (tab2d, SIZE_PLAY);