Skip to content
Snippets Groups Projects
Commit 6f53d0f7 authored by Corto.Cabantous's avatar Corto.Cabantous
Browse files

ajout de prof.c et modification de prof.h

parents c0d71498 939894b0
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);
......
......@@ -17,7 +17,7 @@
#define GAME_INSA_PROJECT_PERSONNAGE_H
/*!
* \struct personnage
* \struct Personnage
* \brief Character structure
*/
......
......@@ -6,12 +6,12 @@
/*!
* \file prof.h
* \brief Character Header File
* \authors corto
* \brief Teacher Header File
* \authors Corto
* \version 1
* \date 25/02/2021
*
* Character structure definiton.
* Teacher structure and functions definiton.
*
*/
......@@ -19,8 +19,8 @@
#define GAME_INSA_PROJECT_PROF_H
/*!
* \struct prof
* \brief Character structure
* \struct Prof
* \brief Teacher structure
*/
typedef struct {
......@@ -28,7 +28,7 @@ typedef struct {
int y_prof; /**< Position : ordinate */
int long_prof; /**< Size : length */
int larg_prof; /**< Size : width */
int speed_prof; /**< Charater speed */
int speed_prof; /**< Teacher speed */
char * image_prof; /**< Source image of the character. */
} Prof;
......
......@@ -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){
......
......@@ -7,12 +7,12 @@
/*!
* \file prof.c
* \brief professor Source File
* \brief Teacher Source File
* \authors corto
* \version 1
* \date 02/03/2021
*
* professor function implementation.
* Teacher function implementation.
*
*/
......@@ -22,19 +22,19 @@
#include "prof.h"
/*!
* \fn int init_pers(Prof * professor, int x, int y, int length, int width, int speed, char * path)
* \brief This function initialize the character : position of the professor's top left corner (x,y), size (length, width), speed and also the path to the character's image.
* \fn int init_pers(Prof * prof, int x, int y, int length, int width, int speed, char * path)
* \brief This function initialize the Teacher : position of the Teacher's top left corner (x,y), size (length, width), speed and also the path to the Teacher's image.
*
* \param [in] professor a pointer on the character
* \param [in] x the professor's abscissa
* \param [in] y the professor's ordinate
* \param [in] length the professor's length
* \param [in] width the professor's width
* \param [in] path the path to the professor's image
* \param [in] Teacher a pointer on the character
* \param [in] x the Teacher's abscissa
* \param [in] y the Teacher's ordinate
* \param [in] length the Teacher's length
* \param [in] width the Teacher's width
* \param [in] path the path to the Teacher's image
* \return 1 if the initialization went right.
*/
int init_pers(Prof * prof, int x, int y, int length, int width, int speed, char * path){
int init_prof(Prof * prof, int x, int y, int length, int width, int speed, char * path){
prof->x_prof=x;
prof->y_prof=y;
prof->long_prof=length;
......
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