feat: adding the list
This commit is contained in:
parent
646a95451d
commit
6cee3288cf
4 changed files with 106 additions and 70 deletions
16
Makefile
16
Makefile
|
|
@ -6,7 +6,7 @@
|
||||||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||||
# Updated: 2024/11/18 14:54:37 by rparodi ### ########.fr #
|
# Updated: 2024/11/22 13:06:59 by rparodi ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -42,17 +42,19 @@ MLXFLAGS = -L$(MLX_DIR) -lmlx -L/opt/X11/lib -lX11 -lXext -lXrender -lXrandr -lX
|
||||||
LDFLAGS += $(MLXFLAGS)
|
LDFLAGS += $(MLXFLAGS)
|
||||||
|
|
||||||
SRC =\
|
SRC =\
|
||||||
raycast/frame_update.c \
|
|
||||||
mlx_layer/mlx_init.c \
|
mlx_layer/mlx_init.c \
|
||||||
parsing/blank_for_raph.c \
|
mlx_layer/mlx_load_texture.c \
|
||||||
parsing/arguments.c \
|
raycast/frame_update.c \
|
||||||
parsing/map.c \
|
raycast/rc_utils.c \
|
||||||
|
sources/options_impl.c \
|
||||||
sources/main.c \
|
sources/main.c \
|
||||||
|
sources/error.c \
|
||||||
sources/cleanups.c \
|
sources/cleanups.c \
|
||||||
sources/options.c \
|
sources/options.c \
|
||||||
sources/rgb_to_color.c \
|
sources/rgb_to_color.c \
|
||||||
sources/error.c \
|
parsing/map.c \
|
||||||
sources/options_impl.c
|
parsing/blank_for_raph.c \
|
||||||
|
parsing/arguments.c
|
||||||
|
|
||||||
|
|
||||||
# Objects
|
# Objects
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/11/11 19:53:42 by rparodi #+# #+# */
|
/* Created: 2024/11/11 19:53:42 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/11/12 06:19:04 by bgoulard ### ########.fr */
|
/* Updated: 2024/11/22 15:17:07 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -32,17 +32,17 @@ int c3_redcross(t_info *info)
|
||||||
{
|
{
|
||||||
return (mlx_loop_end(info->mlx_ptr), EXIT_SUCCESS);
|
return (mlx_loop_end(info->mlx_ptr), EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
t_win_list *c3_init_mlx_window(t_info *info);
|
||||||
t_win_list *c3_init_mlx_window(t_info *info)
|
/*t_win_list *c3_init_mlx_window(t_info *info)*/
|
||||||
{
|
/*{*/
|
||||||
int x;
|
/* int x;*/
|
||||||
int y;
|
/* int y;*/
|
||||||
|
/**/
|
||||||
x = 0;
|
/* x = 0;*/
|
||||||
y = 0;
|
/* y = 0;*/
|
||||||
mlx_get_screen_size(info->mlx_ptr, &x, &y);
|
/* mlx_get_screen_size(info->mlx_ptr, &x, &y);*/
|
||||||
return (mlx_new_window(info->mlx_ptr, x, y, "C3D"));
|
/* return (mlx_new_window(info->mlx_ptr, x, y, "C3D"));*/
|
||||||
}
|
/*}*/
|
||||||
|
|
||||||
int init_mlx_env(t_info *info)
|
int init_mlx_env(t_info *info)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/11/12 12:24:35 by rparodi #+# #+# */
|
/* Created: 2024/11/12 12:24:35 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/11/18 15:41:34 by rparodi ### ########.fr */
|
/* Updated: 2024/11/22 15:35:10 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -45,15 +45,15 @@ double rc_launch(t_info *info, double angle)
|
||||||
t_dpoint rayon;
|
t_dpoint rayon;
|
||||||
|
|
||||||
distance = 0;
|
distance = 0;
|
||||||
direction.x = 0;
|
direction.x = cos(angle);
|
||||||
direction.y = 0;
|
direction.y = sin(angle);
|
||||||
rayon.x = 0;
|
rayon.x = 0;
|
||||||
rayon.y = 0;
|
rayon.y = 0;
|
||||||
while (distance < MAX_RANGE)
|
while (distance < MAX_RANGE)
|
||||||
{
|
{
|
||||||
rayon.x = direction.x * distance;
|
rayon.x = direction.x * distance;
|
||||||
rayon.y = direction.y * distance;
|
rayon.y = direction.y * distance;
|
||||||
if (info->map.map[info->map.fraw[(int)rayon.x][(int)rayon.y]] == WALL)
|
if (info->map.map[(int)info->map.fraw[(int)rayon.x][(int)rayon.y]] == '1')
|
||||||
return (distance);
|
return (distance);
|
||||||
distance += STEP_SIZE;
|
distance += STEP_SIZE;
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +76,6 @@ void shelves_launch(t_info *info, double spacing, double focal, int width)
|
||||||
double angle;
|
double angle;
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
angle = 0;
|
|
||||||
while (x < width)
|
while (x < width)
|
||||||
{
|
{
|
||||||
angle = info->player.view + atan(\
|
angle = info->player.view + atan(\
|
||||||
|
|
@ -85,3 +84,38 @@ void shelves_launch(t_info *info, double spacing, double focal, int width)
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------- */
|
||||||
|
/* Some utils for the mlx window view */
|
||||||
|
/* ----------------------------------- */
|
||||||
|
|
||||||
|
t_win_list *c3_init_mlx_window(t_info *info)
|
||||||
|
{
|
||||||
|
void *window;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
mlx_get_screen_size(info->mlx_ptr, &x, &y);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
window = mlx_new_window(info->mlx_ptr, x, y, "Raycasting");
|
||||||
|
while (i < x)
|
||||||
|
{
|
||||||
|
j = 0;
|
||||||
|
while (j < y)
|
||||||
|
{
|
||||||
|
if (info->map.fraw[i / info->map.size.x][j / info->map.size.y] == '1')
|
||||||
|
mlx_pixel_put(info->mlx_ptr, window, i, j, 0xFFFFFF);
|
||||||
|
else
|
||||||
|
mlx_pixel_put(info->mlx_ptr, window, i, j, 0x000000);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
mlx_loop(info->mlx_ptr);
|
||||||
|
return (window);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue