f
This commit is contained in:
parent
dd33b9a5a9
commit
8eed6feb6b
3 changed files with 139 additions and 0 deletions
45
Makefile
Normal file
45
Makefile
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# **************************************************************************** #
|
||||||
|
# #
|
||||||
|
# ::: :::::::: #
|
||||||
|
# Makefile :+: :+: :+: #
|
||||||
|
# +:+ +:+ +:+ #
|
||||||
|
# By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ #
|
||||||
|
# +#+#+#+#+#+ +#+ #
|
||||||
|
# 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
|
58
algo.c
Normal file
58
algo.c
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* algo.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* 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
|
36
algo.h
Normal file
36
algo.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* algo.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* 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 <unistd.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
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
|
Loading…
Add table
Reference in a new issue