u_ttt/include/view.h
2021-10-18 21:39:00 +02:00

36 lines
968 B
C

#ifndef VIEW_H
#define VIEW_H
#include <ncurses.h>
#include "common.h"
#include "model.h"
typedef struct view * p_view;
/*!
* This function allocates dynamically a struct view in order to handle the corresponding u_tictactoe.
*
* \param p_uttt a pointer on a s_utictactoe.
* \return a reference to the s_utictactoe memory space allocated, NULL in case
* of allocation problem.
*/
p_view create_view(s_utictactoe * p_uttt);
void draw_ttt(WINDOW * w, s_tictactoe * t);
e_location get_ttt_position( int x, int y);
/*!
* This function retrieves a valid move proposal from the user using the corresponding view.
*
* \param p_move a pointer on a s_move to be modified.
* \param v a pointer on the view to use.
*/
void set_next_player_move(s_move * p_move, p_view v);
/*!
* This function free all the memory used by a given view which
* reference is given.
*
* \param v a pointer on a view to be freed.
*/
void free_view(p_view v);
#endif /* VIEW_H */