initial q commit
This commit is contained in:
parent
0a089e04f8
commit
cbeb143cfa
14
Makefile
14
Makefile
@ -1,16 +1,16 @@
|
|||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
# #
|
# #
|
||||||
# :::::::: #
|
# ::: :::::::: #
|
||||||
# Makefile :+: :+: #
|
# Makefile :+: :+: :+: #
|
||||||
# +:+ #
|
# +:+ +:+ +:+ #
|
||||||
# By: qmennen <qmennen@student.codam.nl> +#+ #
|
# By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ #
|
||||||
# +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
|
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
|
||||||
# Updated: 2025/04/14 14:02:01 by whaffman ######## odam.nl #
|
# Updated: 2025/04/15 12:25:12 by qmennen ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME = cub3d
|
NAME = cub3D
|
||||||
-include flags.mk
|
-include flags.mk
|
||||||
|
|
||||||
DIST_PATH = dist
|
DIST_PATH = dist
|
||||||
|
|||||||
17
README.md
17
README.md
@ -1 +1,18 @@
|
|||||||
# Cub3d (by Quinten & Willem)
|
# Cub3d (by Quinten & Willem)
|
||||||
|
|
||||||
|
- Modules
|
||||||
|
-
|
||||||
|
|
||||||
|
- External functions
|
||||||
|
- open
|
||||||
|
- close
|
||||||
|
- read
|
||||||
|
- write
|
||||||
|
- printf
|
||||||
|
- malloc
|
||||||
|
- free
|
||||||
|
- perror
|
||||||
|
- strerror
|
||||||
|
- exit
|
||||||
|
- gettimeofday
|
||||||
|
- All functions of the math library
|
||||||
BIN
build/release/cub3D
Executable file
BIN
build/release/cub3D
Executable file
Binary file not shown.
BIN
en.subject.pdf
Normal file
BIN
en.subject.pdf
Normal file
Binary file not shown.
62
inc/cub3d.h
Normal file
62
inc/cub3d.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* cub3d.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* 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 <MLX42.h>
|
||||||
|
# include <libft.h>
|
||||||
|
|
||||||
|
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
|
||||||
42
src/map.c
Normal file
42
src/map.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user