\doxysection{Référence du fichier function.\+c} \label{function_8c}\index{function.c@{function.c}} {\ttfamily \#include "{}../include/function.\+h"{}}\newline {\ttfamily \#include "{}../include/display.\+h"{}}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+events.\+h$>$}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+image.\+h$>$}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+keycode.\+h$>$}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+rect.\+h$>$}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+render.\+h$>$}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+scancode.\+h$>$}\newline {\ttfamily \#include $<$SDL2/\+SDL\+\_\+timer.\+h$>$}\newline {\ttfamily \#include $<$stdbool.\+h$>$}\newline {\ttfamily \#include $<$stdio.\+h$>$}\newline {\ttfamily \#include $<$stdlib.\+h$>$}\newline {\ttfamily \#include $<$time.\+h$>$}\newline Graphe des dépendances par inclusion de function.\+c\+: % FIG 0 \doxysubsubsection*{Fonctions} \begin{DoxyCompactItemize} \item char $\ast$$\ast$ \textbf{ creat\+Area2D} (const int x, const int y) \begin{DoxyCompactList}\small\item\em Cette fonction permet de creer une liste 2D. \end{DoxyCompactList}\item void \textbf{ free2D} (char $\ast$$\ast$tab, int x) \begin{DoxyCompactList}\small\item\em Cette fontion permet de liberer l\textquotesingle{}espace tu tableau 2D de char. \end{DoxyCompactList}\item char \textbf{ can\+IGo\+Direction} (char value\+Of\+NCase, char value\+Of\+NPlus\+One\+Case) \begin{DoxyCompactList}\small\item\em La fontction permet de savoir si le joueur peut ce deplacer dans une direction. \end{DoxyCompactList}\item void \textbf{ move} (char $\ast$$\ast$tab, \textbf{ vect} $\ast$player\+Pos, \textbf{ vect} direction, \textbf{ score} $\ast$score\+\_\+user) \begin{DoxyCompactList}\small\item\em Cette fonction effectue les deplacements du joueur et des boites en fonction de la situation. \end{DoxyCompactList}\item int \textbf{ in\+Game\+Loop} (char $\ast$$\ast$tab2d, \textbf{ vect} $\ast$dim\+\_\+tab, \textbf{ vect} $\ast$player\+Pos, \textbf{ vect} $\ast$targets, int nbr\+\_\+targets, \textbf{ dis} $\ast$display\+\_\+user, \textbf{ score} $\ast$score\+\_\+user, bool menu) \begin{DoxyCompactList}\small\item\em La fonction permet de faire la boucle de jeu et le menu. \end{DoxyCompactList}\item bool \textbf{ is\+Win} (char $\ast$$\ast$tab2d, \textbf{ vect} $\ast$targets, int nbr\+\_\+targets) \begin{DoxyCompactList}\small\item\em Cette fonction verrifie si la partie est gagnante. \end{DoxyCompactList}\item bool \textbf{ islose} (char $\ast$$\ast$tab2d, const int N) \begin{DoxyCompactList}\small\item\em La fonction renvois si la partie est perdante. \end{DoxyCompactList}\item \textbf{ vect} \textbf{ plus\+Vect} (\textbf{ vect} one, \textbf{ vect} two) \begin{DoxyCompactList}\small\item\em La fonction fait une addition de vecteur, (x1+x2, y1+y2). \end{DoxyCompactList}\item \label{function_8c_a74650c59d33ff53d62ca3a3f8f56a68c} int {\bfseries length\+Vect} (\textbf{ vect} vector) \begin{DoxyCompactList}\small\item\em Renvois la longeur Manhattan. \end{DoxyCompactList}\item bool \textbf{ block\+Box} (char $\ast$$\ast$tab2d, \textbf{ vect} box\+\_\+coor) \begin{DoxyCompactList}\small\item\em La fonction permet de savoir si une boite est dans une situation ou le joueur ne poura pas la debloqué. \end{DoxyCompactList}\item char $\ast$ \textbf{ time\+To\+Text} (time\+\_\+t time) \begin{DoxyCompactList}\small\item\em Cette fonction renvois transforme le forma time en texte. (min\+:sec) \end{DoxyCompactList}\item void \textbf{ null\+Score} (\textbf{ score} $\ast$player\+\_\+score) \begin{DoxyCompactList}\small\item\em Mets à 0 le score. \end{DoxyCompactList}\item void \textbf{ win\+Or\+Lose\+Loop} (\textbf{ dis} $\ast$display\+\_\+user, \textbf{ score} $\ast$score\+\_\+user, bool win) \begin{DoxyCompactList}\small\item\em Fonction de loop pour la win ou la lose. \end{DoxyCompactList}\item \label{function_8c_aeac9c46be252cd970406e3a2391b8e8c} unsigned int {\bfseries score\+Calculator} (\textbf{ score} $\ast$score\+\_\+user, bool win) \end{DoxyCompactItemize} \doxysubsection{Description détaillée} Ce fichier contient toute les fonction utile pour le jeu. Sauf pour l\textquotesingle{}affichage. \doxysubsection{Documentation des fonctions} \index{function.c@{function.c}!blockBox@{blockBox}} \index{blockBox@{blockBox}!function.c@{function.c}} \doxysubsubsection{blockBox()} {\footnotesize\ttfamily \label{function_8c_ac51249b2f7941ca06e6a614e071dd444} bool block\+Box (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{tab2d}{, }\item[{\textbf{ vect}}]{box\+\_\+coor}{}\end{DoxyParamCaption})} La fonction permet de savoir si une boite est dans une situation ou le joueur ne poura pas la debloqué. \begin{DoxyParams}{Paramètres} {\em tab2d} & Le tableau 2D carre du plateau de jeu. \\ \hline {\em box\+\_\+coor} & Les corrdonnée de la boite que la fonction test. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} True si la la boite est bloquer, sinon false. \end{DoxyReturn} Voici le graphe d\textquotesingle{}appel pour cette fonction \+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=234pt]{function_8c_ac51249b2f7941ca06e6a614e071dd444_cgraph} \end{center} \end{figure} Voici le graphe des appelants de cette fonction \+: % FIG 1 \index{function.c@{function.c}!canIGoDirection@{canIGoDirection}} \index{canIGoDirection@{canIGoDirection}!function.c@{function.c}} \doxysubsubsection{canIGoDirection()} {\footnotesize\ttfamily \label{function_8c_a76df2bc0c692d3397837706a6852ac36} char can\+IGo\+Direction (\begin{DoxyParamCaption}\item[{char}]{value\+Of\+NCase}{, }\item[{char}]{value\+Of\+NPlus\+One\+Case}{}\end{DoxyParamCaption})} La fontction permet de savoir si le joueur peut ce deplacer dans une direction. \begin{DoxyParams}{Paramètres} {\em value\+Of\+NCase} & La valeur de la case dans la direction que le joueur veut aller. \\ \hline {\em value\+Of\+NPlus\+One\+Case} & La valeur de la case dans la direction que le joueur veut aller mais une fois de plus. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} 0 Si c\textquotesingle{}est un mur devant le joueur, 1 si c\textquotesingle{}est vide devant le joueur, 2 si c\textquotesingle{}est une boite mais qu\textquotesingle{}on peux la pousser ,3 si le joueur pousse une boite sur un point d\textquotesingle{}interer, 4 si le joueur bouge sur un point d\textquotesingle{}interer, 5 si le joueur peux pousser une boite mais le joueur se place sur un point d\textquotesingle{}interer et 6 si le joueur pousse une boite sur un point d\textquotesingle{}interer et que le joueur est aussi sur un point d\textquotesingle{}interer. 7 si value\+Of\+NCase est un bouton. \end{DoxyReturn} Voici le graphe des appelants de cette fonction \+: % FIG 2 \index{function.c@{function.c}!creatArea2D@{creatArea2D}} \index{creatArea2D@{creatArea2D}!function.c@{function.c}} \doxysubsubsection{creatArea2D()} {\footnotesize\ttfamily \label{function_8c_a1d06514900b90ce163ebe2d5aefc16db} char $\ast$$\ast$ creat\+Area2D (\begin{DoxyParamCaption}\item[{const int}]{x}{, }\item[{const int}]{y}{}\end{DoxyParamCaption})} Cette fonction permet de creer une liste 2D. \begin{DoxyParams}{Paramètres} {\em x} & Nombre de ligne. \\ \hline {\em y} & Nombre de colonne. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} Le pointeur du tableau 2D de char (1 octet). \end{DoxyReturn} \index{function.c@{function.c}!free2D@{free2D}} \index{free2D@{free2D}!function.c@{function.c}} \doxysubsubsection{free2D()} {\footnotesize\ttfamily \label{function_8c_a9011ea69a97e2101aa9bcc52cc60d4ce} void free2D (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{tab}{, }\item[{int}]{x}{}\end{DoxyParamCaption})} Cette fontion permet de liberer l\textquotesingle{}espace tu tableau 2D de char. \begin{DoxyParams}{Paramètres} {\em tab} & Le tableau 2D. \\ \hline {\em x} & Le nombre de ligne. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} Void. \end{DoxyReturn} \index{function.c@{function.c}!inGameLoop@{inGameLoop}} \index{inGameLoop@{inGameLoop}!function.c@{function.c}} \doxysubsubsection{inGameLoop()} {\footnotesize\ttfamily \label{function_8c_a7f8e67bce9078c159778bbe2f57e9d2f} int in\+Game\+Loop (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{tab2d}{, }\item[{\textbf{ vect} $\ast$}]{dim\+\_\+tab}{, }\item[{\textbf{ vect} $\ast$}]{player\+Pos}{, }\item[{\textbf{ vect} $\ast$}]{targets}{, }\item[{int}]{nbr\+\_\+targets}{, }\item[{\textbf{ dis} $\ast$}]{display\+\_\+user}{, }\item[{\textbf{ score} $\ast$}]{score\+\_\+user}{, }\item[{bool}]{menu}{}\end{DoxyParamCaption})} La fonction permet de faire la boucle de jeu et le menu. \begin{DoxyParams}{Paramètres} {\em tab2d} & Le tableau 2d carre. \\ \hline {\em N} & LE nombre d\textquotesingle{}element de tab2d. \\ \hline {\em player\+Pos} & La position de depart du joueur. \\ \hline {\em targets} & Le tableau de toutes les positions des points d\textquotesingle{}interer de la maps. \\ \hline {\em int} & nbr\+\_\+targets Le nombre de point d\textquotesingle{}interer. \\ \hline {\em display\+\_\+user} & Tout les information SDL pour afficher le jeu. \\ \hline {\em score\+\_\+user} & Toute les données nécessaire pour calculer le score fini du joueur. \\ \hline {\em menu} & True si c\textquotesingle{}est la loop du menu. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} L\textquotesingle{}indice de la map si c\textquotesingle{}est un menu, sinon renvoie -\/1 \end{DoxyReturn} Voici le graphe d\textquotesingle{}appel pour cette fonction \+: % FIG 3 \index{function.c@{function.c}!islose@{islose}} \index{islose@{islose}!function.c@{function.c}} \doxysubsubsection{islose()} {\footnotesize\ttfamily \label{function_8c_ac155bb183b0c26d19758d8d065baf14f} bool islose (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{tab2d}{, }\item[{const int}]{N}{}\end{DoxyParamCaption})} La fonction renvois si la partie est perdante. \begin{DoxyParams}{Paramètres} {\em tab2d} & Le tableau 2d carre du plateau de jeu. \\ \hline {\em N} & Le nombre d\textquotesingle{}éléments dans le tab2d. (zone de jeu est carré) \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} True si c\textquotesingle{}est perdu, false si c\textquotesingle{}est pas perdu a cette instant. \end{DoxyReturn} Voici le graphe d\textquotesingle{}appel pour cette fonction \+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=312pt]{function_8c_ac155bb183b0c26d19758d8d065baf14f_cgraph} \end{center} \end{figure} \index{function.c@{function.c}!isWin@{isWin}} \index{isWin@{isWin}!function.c@{function.c}} \doxysubsubsection{isWin()} {\footnotesize\ttfamily \label{function_8c_a618903fbb7302d98ef0f3e2e6b35b99a} bool is\+Win (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{tab2d}{, }\item[{\textbf{ vect} $\ast$}]{targets}{, }\item[{int}]{nbr\+\_\+targets}{}\end{DoxyParamCaption})} Cette fonction verrifie si la partie est gagnante. \begin{DoxyParams}{Paramètres} {\em tab2d} & Le tableau 2D du jeu. \\ \hline {\em targets} & Le tableau de toute les positions des points d\textquotesingle{}interer. \\ \hline {\em nbr\+\_\+targets} & Le nombre de points d\textquotesingle{}interer. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} True si le joueur a remplis tout les points d\textquotesingle{}interer, false si ce n\textquotesingle{}est pas le cas . \end{DoxyReturn} \index{function.c@{function.c}!move@{move}} \index{move@{move}!function.c@{function.c}} \doxysubsubsection{move()} {\footnotesize\ttfamily \label{function_8c_ac93ca31d854d91eedf3babda7511407d} void move (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{tab}{, }\item[{\textbf{ vect} $\ast$}]{player\+Pos}{, }\item[{\textbf{ vect}}]{direction}{, }\item[{\textbf{ score} $\ast$}]{score\+\_\+user}{}\end{DoxyParamCaption})} Cette fonction effectue les deplacements du joueur et des boites en fonction de la situation. \begin{DoxyParams}{Paramètres} {\em tab} & Le tableau 2D du plateau de jeu. \\ \hline {\em playerpos} & La position actuel du joueur. \\ \hline {\em direction} & La direction que le joueur veut effectuer. \\ \hline {\em score\+\_\+user} & Toutes les données nécessaire pour calculer le score fini du joueur. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} Void \end{DoxyReturn} Voici le graphe d\textquotesingle{}appel pour cette fonction \+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=242pt]{function_8c_ac93ca31d854d91eedf3babda7511407d_cgraph} \end{center} \end{figure} Voici le graphe des appelants de cette fonction \+: % FIG 4 \index{function.c@{function.c}!nullScore@{nullScore}} \index{nullScore@{nullScore}!function.c@{function.c}} \doxysubsubsection{nullScore()} {\footnotesize\ttfamily \label{function_8c_a4a66f9d998c95fde67d6f89fef1fded5} void null\+Score (\begin{DoxyParamCaption}\item[{\textbf{ score} $\ast$}]{player\+\_\+score}{}\end{DoxyParamCaption})} Mets à 0 le score. \begin{DoxyParams}{Paramètres} {\em player\+\_\+score} & Le score a mettre à 0. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} void \end{DoxyReturn} \index{function.c@{function.c}!plusVect@{plusVect}} \index{plusVect@{plusVect}!function.c@{function.c}} \doxysubsubsection{plusVect()} {\footnotesize\ttfamily \label{function_8c_a5b10e69716d92eadf2ed0b3942cb9d4d} \textbf{ vect} plus\+Vect (\begin{DoxyParamCaption}\item[{\textbf{ vect}}]{one}{, }\item[{\textbf{ vect}}]{two}{}\end{DoxyParamCaption})} La fonction fait une addition de vecteur, (x1+x2, y1+y2). \begin{DoxyParams}{Paramètres} {\em one} & Premier vecteur. \\ \hline {\em two} & Deuzieme vecteur. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} vect Un vecteur de l\textquotesingle{}addition de one et two. \end{DoxyReturn} Voici le graphe des appelants de cette fonction \+: % FIG 5 \index{function.c@{function.c}!timeToText@{timeToText}} \index{timeToText@{timeToText}!function.c@{function.c}} \doxysubsubsection{timeToText()} {\footnotesize\ttfamily \label{function_8c_a51c9ba7a24383f1b20dcedfcb570aab5} char $\ast$ time\+To\+Text (\begin{DoxyParamCaption}\item[{time\+\_\+t}]{time}{}\end{DoxyParamCaption})} Cette fonction renvois transforme le forma time en texte. (min\+:sec) \begin{DoxyParams}{Paramètres} {\em time} & Le temps qu\textquotesingle{}on veux convertire. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Renvoie} char Le string du texte. \end{DoxyReturn} Voici le graphe des appelants de cette fonction \+: % FIG 6 \index{function.c@{function.c}!winOrLoseLoop@{winOrLoseLoop}} \index{winOrLoseLoop@{winOrLoseLoop}!function.c@{function.c}} \doxysubsubsection{winOrLoseLoop()} {\footnotesize\ttfamily \label{function_8c_a2dc9de2f6fd2bed3619d7ce8c1f05590} void win\+Or\+Lose\+Loop (\begin{DoxyParamCaption}\item[{\textbf{ dis} $\ast$}]{display\+\_\+user}{, }\item[{\textbf{ score} $\ast$}]{score\+\_\+user}{, }\item[{bool}]{win}{}\end{DoxyParamCaption})} Fonction de loop pour la win ou la lose. \begin{DoxyParams}{Paramètres} {\em display\+\_\+user} & Tout les information du display de l\textquotesingle{}utilisateur utile. \\ \hline {\em win} & Si on veut un affichage de victoire ou non. \\ \hline \end{DoxyParams}