Skip to content
Snippets Groups Projects
Commit d0da1cfd authored by llebasca's avatar llebasca
Browse files

map.c/h with doxygen documentation

parent f31f16b0
No related branches found
No related tags found
4 merge requests!8Modele,!7Modele,!6Modele,!5Modele Version 1
......@@ -2,18 +2,34 @@
// Created by Tiny on 2/16/2021.
*/
/*!
* \file map.h
* \brief Map Header File
* \authors Tin
* \version 1
* \date 16/02/2021
*
* Map structure and functions definiton.
*
*/
#ifndef INSAGAME_MAP_H
#define INSAGAME_MAP_H
/*!
* \struct MAP
* \brief Map structure
*/
typedef struct {
char *path; //path of image bmp of map
int width;
int height;
int **functional; //2D functional matrix
char *path; /**< Path of image bmp of map */
int width; /**< Map's width */
int height; /**< Map's height */
int **functional; /**< 2D functional matrix */
} MAP;
int initmap(MAP *map,char *path); //allocate the map's name and call the maptomatrix
int **maptomatrix(MAP *map); //get matrix'length and width => create a functional matrix from the bmp matrix
int initmap(MAP *map,char *path);
int **maptomatrix(MAP *map);
......
......@@ -2,11 +2,32 @@
// Created by Tiny on 2/16/2021.
*/
/*!
* \file map.c
* \brief Map Source File
* \authors Tin
* \version 1
* \date 16/02/2021
*
* Map function implementation.
*
*/
#include "map.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
/*!
* \fn int initmap(MAP *map,char *path)
* \brief This function initialize the map : allocate the map's name and call the maptomatrix
*
* \param [in] map the map pointer
* \param [in] path the map image path
* \return 0 if the initialization went right.
*/
int initmap(MAP *map,char *path){
int lenpath = strlen(path); //get the path lenght
map->path = (char *)malloc((lenpath)*sizeof(char)); //allocate the path
......@@ -15,6 +36,13 @@ int initmap(MAP *map,char *path){
return 0;
}
/*!
* \fn int **maptomatrix(MAP *map)
* \brief This function gets the matrix's length and width and creates a functional matrix from the bmp matrix.
*
* \param [in] map the map pointer
* \return NULL if there is an error when opening the map, fonc otherwise.
*/
int **maptomatrix(MAP *map){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment