This commit is contained in:
2024-12-14 04:13:59 +01:00
parent 5a2a2afe0a
commit 19a05574ab
5 changed files with 31 additions and 33 deletions

View File

@@ -1,7 +1,8 @@
#include <stdio.h>
#include "display.h"
#include <stdio.h>
void screenDisplay( unsigned short int **tab,int size)
void
screenDisplay (unsigned short int **tab, int size)
{
// puts("0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 ");
char element[7] = { ' ', '#', 'S', '.', '*', '@', '+' };
@@ -13,5 +14,4 @@ void screenDisplay( unsigned short int **tab,int size)
}
puts ("");
}
}

View File

@@ -180,10 +180,7 @@ move (unsigned short int **tab, vect *playerPos, vect direction)
}
void
inGameLoop (unsigned short int **tab2d,
int N,
vect *playerPos,
vect *targets,
inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets,
int nbr_targets)
{
vect direction = { 0, 0 };

13
main.c
View File

@@ -1,12 +1,13 @@
#include <stdio.h>
#include <time.h>
#include "display.h"
#include "function.h"
#include "read.h"
#include "display.h"
#include <stdio.h>
#include <time.h>
#define SIZE_PLAY 24
int main()
int
main ()
{
vect *playerPos = (vect *)malloc (sizeof (vect));
vect *targets;
@@ -14,11 +15,11 @@ int main()
score playerScore;
playerScore.before = time (NULL);
unsigned short int **tab2d = creatArea2D (SIZE_PLAY);
targets = fileToTab2D("test.txt", tab2d, SIZE_PLAY, playerPos, &nbr_targets);
targets
= fileToTab2D ("test.txt", tab2d, SIZE_PLAY, playerPos, &nbr_targets);
screenDisplay (tab2d, SIZE_PLAY);
inGameLoop (tab2d, SIZE_PLAY, playerPos, targets, nbr_targets);
playerScore.after = time (NULL);
printf ("%ld\n", playerScore.after - playerScore.before);
free2D (tab2d, SIZE_PLAY);