diff --git a/Makefile b/Makefile index 16f496f..1198095 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,16 @@ # **************************************************************************** # # # -# :::::::: # -# Makefile :+: :+: # -# +:+ # -# By: qmennen +#+ # -# +#+ # -# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/04/14 14:02:01 by whaffman ######## odam.nl # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: qmennen +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # +# Updated: 2025/04/15 12:25:12 by qmennen ### ########.fr # # # # **************************************************************************** # -NAME = cub3d +NAME = cub3D -include flags.mk DIST_PATH = dist diff --git a/README.md b/README.md index 34e8a93..263a43b 100644 --- a/README.md +++ b/README.md @@ -1 +1,18 @@ # Cub3d (by Quinten & Willem) + +- Modules + - + +- External functions + - open + - close + - read + - write + - printf + - malloc + - free + - perror + - strerror + - exit + - gettimeofday + - All functions of the math library \ No newline at end of file diff --git a/build/release/cub3D b/build/release/cub3D new file mode 100755 index 0000000..e8d560d Binary files /dev/null and b/build/release/cub3D differ diff --git a/cub3D b/cub3D new file mode 100755 index 0000000..e8d560d Binary files /dev/null and b/cub3D differ diff --git a/en.subject.pdf b/en.subject.pdf new file mode 100644 index 0000000..6dd3419 Binary files /dev/null and b/en.subject.pdf differ diff --git a/inc/cub3d.h b/inc/cub3d.h new file mode 100644 index 0000000..3ccdb7d --- /dev/null +++ b/inc/cub3d.h @@ -0,0 +1,62 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* cub3d.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: qmennen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */ +/* Updated: 2025/04/15 12:51:19 by qmennen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef CUB3D_H +# define CUB3D_H + +# include +# include + +typedef enum TILE +{ + TILE_VOID = -1, + TILE_EMPTY = 0, + TILE_WALL = 1, + TILE_PLAYER = 2, +} t_tile; + +typedef struct s_vec2 +{ + float x; + float y; +} t_vec2; + +typedef struct s_player +{ + t_vec2 pos; + float speed; + float angle; + float fov; +} t_player; + +typedef struct s_map +{ + unsigned int width; + unsigned int height; + t_tile **grid; +} t_map; + +typedef struct s_screen +{ + mlx_t *mlx; + mlx_image_t *img; + unsigned int width; + unsigned int height; +} t_screen; + +typedef struct s_game +{ + t_map *map; + t_player *player; +} t_game; + +#endif \ No newline at end of file diff --git a/src/map.c b/src/map.c new file mode 100644 index 0000000..5677f47 --- /dev/null +++ b/src/map.c @@ -0,0 +1,42 @@ +#include "stdlib.h" +#include "cub3d.h" + + +t_tile **get_temp_map() +{ + const t_tile map[10][10] = + { + {-1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 1, 1}, + {1, 0, 0, 2, 0, 0, 0, 1, 0, 1}, + {1, 0, 0, 0, 0, 1, 0, 1, 0, 1}, + {1, 0, 0, 0, 0, 1, 1, 1, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 1, 1}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + t_tile **temp_map = malloc(10 * sizeof(int *)); + if (!temp_map) + return NULL; + + for (int i = 0; i < 10; i++) + { + temp_map[i] = malloc(10 * sizeof(int)); + if (!temp_map[i]) + { + for (int j = 0; j < i; j++) + free(temp_map[j]); + free(temp_map); + return NULL; + } + for (int j = 0; j < 10; j++) + { + temp_map[i][j] = map[i][j]; + } + } + + return temp_map; +} \ No newline at end of file