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,41 +1,61 @@
#include "cube3d.h"
int is_esc(int *k_hook)
int is_esc(int *k_hook, int *is_action)
{
if (!ft_arrintchr(k_hook, KEY_ESC, 3))
if (!ft_arrintchr(k_hook, KEY_ESC, MAX_NB_KEY))
{
*is_action = 1;
return 1;
}
return 0;
}
int is_go_left(int *k_hook)
int is_go_left(int *k_hook, int *is_action)
{
if (!ft_arrintchr(k_hook, KEY_A, 3))
if (!ft_arrintchr(k_hook, KEY_A, MAX_NB_KEY))
{
*is_action = 1;
return 1;
if (!ft_arrintchr(k_hook, KEY_Q, 3))
}
if (!ft_arrintchr(k_hook, KEY_Q, MAX_NB_KEY))
{
*is_action = 1;
return 1;
}
return 0;
}
int is_go_right(int *k_hook)
int is_go_right(int *k_hook, int *is_action)
{
if (!ft_arrintchr(k_hook, KEY_D, 3))
if (!ft_arrintchr(k_hook, KEY_D, MAX_NB_KEY))
{
*is_action = 1;
return 1;
}
return 0;
}
int is_go_forward(int *k_hook)
int is_go_forward(int *k_hook, int *is_action)
{
if (!ft_arrintchr(k_hook, KEY_W, 3))
if (!ft_arrintchr(k_hook, KEY_W, MAX_NB_KEY))
{
*is_action = 1;
return 1;
if (!ft_arrintchr(k_hook, KEY_Z, 3))
}
if (!ft_arrintchr(k_hook, KEY_Z, MAX_NB_KEY))
{
*is_action = 1;
return 1;
}
return 0;
}
int is_go_backward(int *k_hook)
int is_go_backward(int *k_hook, int *is_action)
{
if (!ft_arrintchr(k_hook, KEY_S, 3))
if (!ft_arrintchr(k_hook, KEY_S, MAX_NB_KEY))
{
*is_action = 1;
return 1;
}
return 0;
}