Newer
Older
//
// Created by CABANTOUS corto on 25/02/2021.
//
/*!
* \file prof.c
* \version 1
* \date 02/03/2021
*
* Teacher function implementation.
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
#include "prof.h"
/*!
* \fn int init_prof(Prof * prof, int x, int y, int length, int width, int speed, char * path)
* \brief This function initializes 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] 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] speed the Teacher's speed
* \param [in] path the path to the Teacher's image
void 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;
prof->larg_prof=width;
prof->speed_prof=speed;
prof->image_prof = malloc(strlen(path));
strcpy(prof->image_prof, path);
/*!
* \fn void calculpointsprof(Prof * prof)
* \brief This function calcult the 3 others corners of the teacher
*
* \param [in] Teacher a pointer on the character
*/
prof->x_hr = prof->x_prof + prof->larg_prof ;
prof->y_hr = prof->y_prof;
prof->x_ll = prof->x_prof;
prof->y_ll = prof->y_prof + prof->long_prof;
prof->x_lr = prof->x_prof + prof->larg_prof;
prof->y_lr = prof->y_prof + prof->long_prof;