DropMapPixel changed to RenderFrame

This commit is contained in:
2025-12-11 19:49:23 +01:00
parent 3027b08300
commit d296e1b6f2
3 changed files with 13 additions and 20 deletions

View File

@@ -31,7 +31,7 @@ gnl:
@$(MAKE) -C $(GNL) @$(MAKE) -C $(GNL)
%.o: %.c %.o: %.c
@$(CC) $(CFLAGS) -o $@ -c $< $(HEADERS) && printf "Compiling: $(notdir $<)" @$(CC) $(CFLAGS) -o $@ -c $< $(HEADERS) && printf "Compiling: $(notdir $<)\n"
$(NAME): $(OBJS) $(NAME): $(OBJS)
@$(CC) $(OBJS) $(LIBS) $(HEADERS) -o $(NAME) @$(CC) $(OBJS) $(LIBS) $(HEADERS) -o $(NAME)

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */ /* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */
/* Updated: 2025/12/09 21:48:51 by aortigos ### ########.fr */ /* Updated: 2025/12/11 19:47:53 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -25,18 +25,13 @@
# include "../lib/ft_printf/ft_printf.h" # include "../lib/ft_printf/ft_printf.h"
# include "../lib/gnl/get_next_line.h" # include "../lib/gnl/get_next_line.h"
/*═══════════════════════════ [ MACROS ] ═══════════════════════════════════*/
// MLX - GAME # define S_W 1900
# define S_H 1000
# define S_W 1900 // screen width # define WALL_SIZE 30
# define S_H 1000 // screen height # define FOV 60
# define WALL_SIZE 30 // wall size # define ROTATION_SPEED 0.045
# define FOV 60 // field of view # define PLAYER_SPEED 3
# define ROTATION_SPEED 0.045 // rotation speed
# define PLAYER_SPEED 3 // player speed
// ERROR
# define ERR_INV_COP "Error: invalid argument\n" # define ERR_INV_COP "Error: invalid argument\n"
# define ERR_INV_FILE "Error: invalid file\n" # define ERR_INV_FILE "Error: invalid file\n"
@@ -47,8 +42,6 @@
# define ERR_MAP_DUP "Error: duplicate map element\n" # define ERR_MAP_DUP "Error: duplicate map element\n"
# define ERR_MAP_RGB "Error: invalid color map [RGB]\n" # define ERR_MAP_RGB "Error: invalid color map [RGB]\n"
/*══════════════════════════ [ STRUCTS ] ═══════════════════════════════════*/
typedef struct s_tex typedef struct s_tex
{ {
mlx_texture_t *no; mlx_texture_t *no;
@@ -205,7 +198,7 @@ float nor_angle(float angle);
int unit_circle(float angle, char c); int unit_circle(float angle, char c);
// execution.c // execution.c
void drow_map_pixel(void *mlxl); void render_frame(void *mlx_ptr);
int check_load_ture(t_turelist *list); int check_load_ture(t_turelist *list);
int load_texture(t_tex *tex, t_turelist *l_ture); int load_texture(t_tex *tex, t_turelist *l_ture);
void get_angle(t_mlx *mlx); void get_angle(t_mlx *mlx);

View File

@@ -6,17 +6,17 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/09 18:46:27 by aortigos #+# #+# */ /* Created: 2025/12/09 18:46:27 by aortigos #+# #+# */
/* Updated: 2025/12/09 20:56:36 by aortigos ### ########.fr */ /* Updated: 2025/12/11 19:48:18 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../includes/cub3d.h" #include "../../includes/cub3d.h"
void drow_map_pixel(void *mlxl) void render_frame(void *mlx_ptr)
{ {
t_mlx *mlx; t_mlx *mlx;
mlx = mlxl; mlx = mlx_ptr;
mlx_delete_image(mlx->mlx_ptr, mlx->img); mlx_delete_image(mlx->mlx_ptr, mlx->img);
mlx->img = mlx_new_image(mlx->mlx_ptr, S_W, S_H); mlx->img = mlx_new_image(mlx->mlx_ptr, S_W, S_H);
cub_hook(mlx, 0, 0); cub_hook(mlx, 0, 0);
@@ -110,7 +110,7 @@ int execution(t_data *dt)
return (ft_exit(&mlx), 0); return (ft_exit(&mlx), 0);
get_angle(&mlx); get_angle(&mlx);
mlx_key_hook(mlx.mlx_ptr, &key_press, &mlx); mlx_key_hook(mlx.mlx_ptr, &key_press, &mlx);
mlx_loop_hook(mlx.mlx_ptr, &drow_map_pixel, &mlx); mlx_loop_hook(mlx.mlx_ptr, &render_frame, &mlx);
mlx_loop(mlx.mlx_ptr); mlx_loop(mlx.mlx_ptr);
ft_exit(&mlx); ft_exit(&mlx);
return (0); return (0);