player rotates and moves, rays for raycasting on map

This commit is contained in:
Hugo LAMY
2022-04-18 18:27:16 +02:00
parent 00b3612c16
commit 01eb2255d2
21 changed files with 689 additions and 138 deletions

View File

@@ -1,15 +1,46 @@
#include "cube3d.h"
t_exit **mb_exit_func()
{
static t_exit *texit = NULL;
/* private struct definition :
* https://stackoverflow.com/questions/71724770/prototype-of-a-struct-in-c
* it wasn't necessary after all :p I just added setters and getters here
*/
if (!texit)
texit = mb_alloc(sizeof(t_exit));
return (&texit);
typedef void(*t_mb_func_exit)(void*);
typedef struct s_mb_exit
{
t_mb_func_exit f;
void *param;
} t_mb_exit;
static t_mb_exit *mb_get_exit_struct(void)
{
static t_mb_exit *mbexit = NULL;
if (!mbexit)
mbexit = mb_alloc(sizeof(t_mb_exit));
return (mbexit);
}
t_list **mb_lst()
void mb_set_params_exit(void (*f)(void *), void *param)
{
t_mb_exit *mbexit;
mbexit = mb_get_exit_struct();
mbexit->param = param;
mbexit->f = f;
}
void mb_exec_exit_func(void)
{
t_mb_exit *mbexit;
mbexit = mb_get_exit_struct();
if (mbexit->f)
mbexit->f(mbexit->param);
}
t_list **mb_get_lst(void)
{
static t_list *lst = NULL;
@@ -20,4 +51,3 @@ int mb_comp_addr(void *to_find, void *to_compare)
{
return (to_find == to_compare);
}