From 085d28f84211c2dcf2ec8ffdd027985bd7295ae6 Mon Sep 17 00:00:00 2001 From: Souidi Date: Thu, 1 Dec 2022 23:45:25 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20d'un=20fichier=20d=C3=A9di?= =?UTF-8?q?=C3=A9=20=C3=A0=20la=20gestion=20des=20cartes=20et=20modificati?= =?UTF-8?q?on=20de=20la=20structure=20card?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/card.h | 12 ++++++++++++ src/card.c | 17 +++++++++++++++++ src/game.c | 12 +----------- 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 include/card.h create mode 100644 src/card.c diff --git a/include/card.h b/include/card.h new file mode 100644 index 0000000..a5ec203 --- /dev/null +++ b/include/card.h @@ -0,0 +1,12 @@ +#ifndef CARD_H +#define CARD_H + +typedef struct { + zone zone; + int displayed, found; + char *file; +} card; + +card create_card(int x, int y, int L, int H, char *file); + +#endif \ No newline at end of file diff --git a/src/card.c b/src/card.c new file mode 100644 index 0000000..04edc4d --- /dev/null +++ b/src/card.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include"../include/main.h" + +typedef struct { + zone zone; + int displayed, found; + char *file; +} card; + +card create_card(int x, int y, int L, int H, char *file) { + zone zone = {x, y, L, H}; + card carte = {zone, 0, 0, file}; + DessinerRectangle(carte.zone.x, carte.zone.y, carte.zone.L, carte.zone.H); + return carte; +} \ No newline at end of file diff --git a/src/game.c b/src/game.c index 64fc6d4..c810cf9 100644 --- a/src/game.c +++ b/src/game.c @@ -4,6 +4,7 @@ #include #include"../include/main.h" #include"../include/timer.h" +#include"../include/card.h" #include"../include/fin.h" #define GAME_MARGIN_RIGHT 20 @@ -11,17 +12,6 @@ #define GAME_MARGIN_TOP 35 #define GAME_MARGIN_BOTTOM 20 -typedef struct { - int x, y, L, H, displayed, found; - char *file; -} card; - -card create_card(int x, int y, int L, int H, char *file) { - card carte = {x, y, L, H, 0, 0, file}; - DessinerRectangle(x, y, L, H); - return carte; -} - int game(int colonnes, int lignes) { int i, j, t, used, r, l, c, case_max_width, case_max_height, case_max_dimensions, case_margin, boucle; unsigned long int timer;