GNL now using libft functions

This commit is contained in:
2025-11-16 20:34:13 +01:00
parent 06d5582e88
commit a7dbd94e42
6 changed files with 14 additions and 82 deletions

View File

@@ -22,7 +22,7 @@ libmlx:
@cmake $(LIBMLX) -B $(LIBMLX)/build && make -C $(LIBMLX)/build -j4 @cmake $(LIBMLX) -B $(LIBMLX)/build && make -C $(LIBMLX)/build -j4
libft: libft:
@$(MAKE) -C $(LIBFT) bonus @$(MAKE) -C $(LIBFT)
ft_printf: ft_printf:
@$(MAKE) -C $(FTPRINTF) @$(MAKE) -C $(FTPRINTF)

View File

@@ -14,25 +14,7 @@
# define S_W 800 # define S_W 800
# define S_H 600 # define S_H 600
# define FOV 60 # define FOV 60
# define TILE_SIZE 50 # define PLAYER_SPEED 3
typedef struct s_player
{
int player_x;
int player_y;
double angel;
float fov;
int rot;
int l_r;
int u_d;
} t_player;
typedef struct s_mlx
{
mlx_image_t *img;
mlx_t *mlx_ptr;
t_player *player;
char **map;
} t_mlx;
#endif #endif

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* get_next_line.h :+: :+: :+: */ /* get_next_line.h :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/15 18:52:24 by aortigos #+# #+# */ /* Created: 2024/03/15 18:52:24 by aortigos #+# #+# */
/* Updated: 2024/03/15 18:52:26 by aortigos ### ########.fr */ /* Updated: 2025/11/16 20:32:59 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -16,6 +16,7 @@
# include <unistd.h> # include <unistd.h>
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
# include "../libft/libft.h"
# ifndef BUFFER_SIZE # ifndef BUFFER_SIZE
# define BUFFER_SIZE 10000 # define BUFFER_SIZE 10000
@@ -23,9 +24,6 @@
char *get_next_line(int fd); char *get_next_line(int fd);
char *ft_read_to_left_str(int fd, char *left_str); char *ft_read_to_left_str(int fd, char *left_str);
size_t ft_strlen(char *s);
char *ft_strchr(char *s, int c);
char *ft_strjoin(char *left_str, char *buff);
char *ft_get_line(char *left_str); char *ft_get_line(char *left_str);
char *ft_new_left_str(char *left_str); char *ft_new_left_str(char *left_str);

View File

@@ -3,49 +3,15 @@
/* ::: :::::::: */ /* ::: :::::::: */
/* get_next_line_utils.c :+: :+: :+: */ /* get_next_line_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/15 18:37:57 by aortigos #+# #+# */ /* Created: 2024/03/15 18:37:57 by aortigos #+# #+# */
/* Updated: 2024/03/15 18:56:09 by aortigos ### ########.fr */ /* Updated: 2025/11/16 20:33:54 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "get_next_line.h" #include "get_next_line.h"
size_t ft_strlen(char *s)
{
int i;
i = 0;
if (!s)
return (0);
while (s[i] != '\0')
{
i++;
}
return (i);
}
char *ft_strchr(char *s, int c)
{
int i;
i = 0;
if (!s)
return (0);
if (c == '\0')
return ((char *)&s[ft_strlen(s)]);
while (s[i] != '\0')
{
if (s[i] == (char) c)
{
return ((char *)&s[i]);
}
i++;
}
return (0);
}
char *ft_strjoin(char *left_str, char *buff) char *ft_strjoin(char *left_str, char *buff)
{ {
size_t i; size_t i;

View File

@@ -17,8 +17,6 @@ SRC = ft_strlen.c ft_strlcpy.c ft_strlcat.c ft_strchr.c \
ft_memfree.c ft_issign.c ft_isspace.c ft_iabs.c \ ft_memfree.c ft_issign.c ft_isspace.c ft_iabs.c \
ft_strcmp.c ft_strcmp.c
OBJ = $(SRC:.c=.o) OBJ = $(SRC:.c=.o)
CC = cc CC = cc

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/14 09:35:53 by aortigos #+# #+# */ /* Created: 2025/11/14 09:35:53 by aortigos #+# #+# */
/* Updated: 2025/11/15 10:29:24 by aortigos ### ########.fr */ /* Updated: 2025/11/16 20:29:38 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -23,24 +23,12 @@
// -> -> mostrar imagen en ventana // -> -> mostrar imagen en ventana
// salir y liberar memoria // salir y liberar memoria
int check_extension(char *str)
{
int i;
i = ft_strlen(str);
if (i < 4)
return (0);
if (ft_strncmp(str + (i - 4), ".cub", 4) == 0)
return (1);
return (0);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
if (argc != 2 || !check_extension(argv[1])) t_data data;
{
ft_printf("Hace falta un archivo .cub\n"); if (!parsing(argc, argv, &data))
return (1); return (1);
} execution(&data);
ft_printf("Archivo recibido: %s\n", argv[1]); return (0);
} }