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

Personnage and DS initialization

parent afc6fe54
No related branches found
No related tags found
4 merge requests!8Modele,!7Modele,!6Modele,!5Modele Version 1
......@@ -21,9 +21,11 @@
* \brief DS structure
*/
struct DS {
typedef struct {
int door; /**< Integer representing the door number i.e. the DS location. */
char * image_DS; /**< Source image of the DS. */
};
} DS;
int init_DS(DS * exam, int door_DS, char * path);
#endif /*INSAGAME_DS_H*/
......@@ -9,7 +9,7 @@
* \version 1
* \date 25/02/2021
*
* Character structure definiton.
* Character structure and functions definiton.
*
*/
......@@ -21,13 +21,15 @@
* \brief Character structure
*/
struct personnage {
typedef struct {
int x_pers; /**< Position : abscissa */
int y_pers; /**< Position : ordinate */
int long_pers; /**< Size : length */
int larg_pers; /**< Size : width */
int speed_pers; /**< Charater speed */
char * image_pers; /**< Source image of the character. */
};
}Personnage;
int init_pers(Personnage * character, int x, int y, int length, int width, int speed, char * path);
#endif /*GAME_INSA_PROJECT_PERSONNAGE_H*/
/*
// Created by Lucile on 02/03/2021.
*/
/*!
* \file DS.c
* \brief Exam Source File
* \authors Lucile
* \version 1
* \date 02/03/2021
*
* Character function implementation.
*
*/
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "DS.h"
/*!
* \fn int init_DS(DS * exam, int door_DS, char * path)
* \brief This function initialize a DS : position (the door number) and the path to the DS's image.
*
* \param [in] exam a DS pointer
* \param [in] door_DS a door number corresponding to the DS location
* \param [in] path the DS image path
* \return 1 if the initialization went right.
*/
int init_DS(DS * exam, int door_DS, char * path){
exam->door=door_DS;
exam->image_DS = malloc(strlen(path));
strcpy(exam->image_DS, path);
return 1;
}
\ No newline at end of file
/*
// Created by Lucile on 25/02/2021.
*/
/*!
* \file personnage.c
* \brief Character Source File
* \authors Lucile
* \version 1
* \date 02/03/2021
*
* Character function implementation.
*
*/
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "personnage.h"
/*!
* \fn int init_pers(Personnage * character, int x, int y, int length, int width, int speed, char * path)
* \brief This function initialize the character : position of the character's top left corner (x,y), size (length, width), speed and also the path to the character's image.
*
* \param [in] character a pointer on the character
* \param [in] x the character's abscissa
* \param [in] y the character's ordinate
* \param [in] length the character's length
* \param [in] width the character's width
* \param [in] path the path to the character's image
* \return 1 if the initialization went right.
*/
int init_pers(Personnage * character, int x, int y, int length, int width, int speed, char * path){
character->x_pers=x;
character->y_pers=y;
character->long_pers=length;
character->larg_pers=width;
character->speed_pers=speed;
character->image_pers = malloc(strlen(path));
strcpy(character->image_pers, path);
return 1;
}
\ No newline at end of file
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