Skip to content
Snippets Groups Projects
grid.h 1.18 KiB
Newer Older
#ifndef GRID_HEADER
#define GRID_HEADER
#include "player.h"
enum CaseType
{
  WALL = '#',
  BOX = '$',
  PLAYER = '@',
  GOAL = '.',
  NONE = ' '
};
Arnaud Albiez's avatar
Arnaud Albiez committed
  int col, row;
/**
 * @struct Grid grid.h
 * @brief Cette structure contient les informations
 * concernant la grille du jeu et son contenu
 */
struct Grid
{
  enum CaseType *game_grid; ///< Tableau contenant les entités présents dans le jeu
  int column_number;        ///< Nombre de colonne de game_grid
  int row_number;           ///< Nomber de ligne de game_grid
  struct Player *position;  ///< Positioin du joueur
  struct Goal *tabGoal;     ///< Liste des but
  int number_goal;          ///< nombre de goal
Arnaud Albiez's avatar
Arnaud Albiez committed
int coordonner_vers_indice(struct Grid *grid, int col, int row);
enum CaseType *init_grid(int width, int height);
struct Player *init_player();
struct Grid *new_grid(int width, int height);
struct Grid *init_level(const char *file_path);
enum CaseType get_grid(struct Grid *grid, int x, int y);
int get_goal(struct Grid *grid, int x, int y);
void Affichage_grid(struct Grid *grid);
void change_cell_grid(struct Grid *grid, int x, int y, enum CaseType new_valeur);
void free_grid(struct Grid *grid);