diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..72fd05f --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: grobledo +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2024/07/29 13:08:42 by greg #+# #+# # +# Updated: 2024/10/01 18:58:09 by grobledo ### ########.fr # +# # +# **************************************************************************** # + +NAME = cub3d + +SRC = + +OBJS = ${SRC:.c=.o} + +LIBFT = Libft + +MLX = Minilibx + +CC = gcc -g + +CFLAGS = -Wall -Werror -Wextra + +obj : ${OBJS} + +all: $(NAME) + +$(NAME): ${OBJS} + + make -C ${LIBFT} + make -C ${MLX} + gcc ${OBJS} Libft/libft.a Minilibx/libmlx.a -lX11 -lXext -o cub3d + +clean : + rm -f ${OBJS} + +fclean : clean + rm -f $(NAME) + make fclean -C ${LIBFT} + make clean -C ${MLX} + +re : fclean all diff --git a/algo.c b/algo.c new file mode 100644 index 0000000..bacfda7 --- /dev/null +++ b/algo.c @@ -0,0 +1,58 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* algo.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: grobledo +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/10/01 16:24:58 by grobledo #+# #+# */ +/* Updated: 2024/10/01 18:57:51 by grobledo ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "algo.h" + + +int algo(struct) +{ + double posX; + double posY; //position x et y du joueur sur la map + double dirX; + double dirY; // orientation du joeur sur la map + double planeX; + double planeY;// position de la cam + double currtime; // temps frame actuelle + double oldtime; // temps derniere frame + + posX = 2; + posY = 2; + dirX = -1; + dirY = 0; + planeX = 0; + planeY = 0.66; // FOV de 66 degres + currtime = 0; + oldtime = 0; + +} + +// int initalgo(struct) +// { +// posX = 2; +// posY = 2; +// dirX = -1; +// dirY = 0; +// planeX = 0; +// planeY = 0.66; // FOV de 66 degres +// currtime = 0; +// oldtime = 0; +// return (0); +// } + + + + +// https://github.com/iciamyplant/Cub3d-Linux + +// https://lodev.org/cgtutor/raycasting.html + +// https://www.youtube.com/watch?v=js7HW65MmNw&list=PL0H9-oZl_QOHM34HvD3DiGmwmj5X7GvTW diff --git a/algo.h b/algo.h new file mode 100644 index 0000000..9ed7355 --- /dev/null +++ b/algo.h @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* algo.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: grobledo +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/09/30 15:45:59 by grobledo #+# #+# */ +/* Updated: 2024/10/01 18:57:39 by grobledo ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef ALGO_H +#define ALGO_H + +#include +#include + +typedef struct s_player +{ + // pos player on map + double posX; + double posY; + // orientation player on map + double dirX; + double dirY; + // orientation cam on map + double planeX; + double planeY; + // current frame + double currtime; + // last frame + double oldtime; +} t_player; + +#endif