fix size play dinamic

This commit is contained in:
2024-12-12 20:46:48 +01:00
parent 2c61fbe868
commit 21885b0f99
3 changed files with 10 additions and 8 deletions

View File

@@ -156,7 +156,7 @@ void move (unsigned short int **tab, vect *playerPos, vect direction)
}
}
void inGameLoop (unsigned short int **tab2d, vect *playerPos, vect *targets, int nbr_targets)
void inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets, int nbr_targets)
{
vect direction = { 0, 0 };
char input;
@@ -205,7 +205,7 @@ void inGameLoop (unsigned short int **tab2d, vect *playerPos, vect *targets, int
{
finish = true;
}
screenDisplay (tab2d, 32);
screenDisplay (tab2d, N);
}
}

View File

@@ -20,7 +20,7 @@ typedef struct Vecteur
unsigned short int **creatArea2D(const unsigned int N);
void screenDisplay( unsigned short int **tab,int size);
void inGameLoop (unsigned short int **tab2d, vect *playerPos, vect *targets, int nbr_targets);
void inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets, int nbr_targets);
bool isWin(unsigned short int **tab2d, vect *targets, int nbr_targets);
#endif // FONCTION_H

12
main.c
View File

@@ -1,17 +1,19 @@
#include <stdio.h>
#include "function.h"
#include "display.h"
#include "read.h"
#include "display.h"
#define SIZE_PLAY 24
int main()
{
vect *playerPos = (vect *)malloc(sizeof(vect));
vect *targets;
int nbr_targets;
unsigned short int **tab2d = creatArea2D(32);
targets = fileToTab2D("test.txt", tab2d, 32, playerPos, &nbr_targets);
screenDisplay(tab2d, 32);
inGameLoop(tab2d,playerPos, targets, nbr_targets);
unsigned short int **tab2d = creatArea2D(SIZE_PLAY);
targets = fileToTab2D("test.txt", tab2d, SIZE_PLAY, playerPos, &nbr_targets);
screenDisplay(tab2d, SIZE_PLAY);
inGameLoop(tab2d, SIZE_PLAY, playerPos, targets, nbr_targets);
free(playerPos);
return 0;
}