time + fix leak memories

This commit is contained in:
2024-12-13 12:11:20 +01:00
parent 14e05afdce
commit d5abc56d1b
4 changed files with 33 additions and 5 deletions

10
main.c
View File

@@ -1,4 +1,5 @@
#include <stdio.h>
#include <time.h>
#include "function.h"
#include "read.h"
#include "display.h"
@@ -10,11 +11,18 @@ int main()
vect *playerPos = (vect *)malloc(sizeof(vect));
vect *targets;
int nbr_targets;
score playerScore;
playerScore.before = time(NULL);
unsigned short int **tab2d = creatArea2D(SIZE_PLAY);
targets = fileToTab2D("test.txt", tab2d, SIZE_PLAY, playerPos, &nbr_targets);
screenDisplay(tab2d, SIZE_PLAY);
printf("player (%d, %d)", playerPos->x, playerPos->y);
inGameLoop(tab2d, SIZE_PLAY, playerPos, targets, nbr_targets);
playerScore.after = time(NULL);
printf("%ld\n", playerScore.after - playerScore.before);
free2D(tab2d, SIZE_PLAY);
free(playerPos);
free(targets);
return 0;
}