diff options
Diffstat (limited to '')
| -rw-r--r-- | inc/cub3d.h | 31 | ||||
| -rw-r--r-- | inc/cub3d_defines.h | 56 | ||||
| -rw-r--r-- | inc/cub3d_structs.h | 3 | ||||
| -rw-r--r-- | src/ft_check_missing.c | 20 | 
4 files changed, 71 insertions, 39 deletions
| diff --git a/inc/cub3d.h b/inc/cub3d.h index 699dc6a..386f658 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -13,37 +13,10 @@  #	ifndef CUB3D_H  #	define CUB3D_H +#include <cub3d_defines.h> +#include <cub3d_structs.h>  #include <stddef.h>  #include <stdint.h> -#include <cub3d_structs.h> - -#	ifndef FT_W_KEY -#	define FT_W_KEY 13 -#	endif -#	ifndef FT_A_KEY -#	define FT_A_KEY 0 -#	endif -#	ifndef FT_S_KEY -#	define FT_S_KEY 1 -#	endif -#	ifndef FT_D_KEY -#	define FT_D_KEY 2 -#	endif -#	ifndef FT_L_ARR_KEY -#	define FT_L_ARR_KEY 123 -#	endif -#	ifndef FT_R_ARR_KEY -#	define FT_R_ARR_KEY 124 -#	endif -#	ifndef FT_ESC_KEY -#	define FT_ESC_KEY 53 -#	endif -#	ifndef FT_F1_KEY -#	define FT_F1_KEY 122 -#	endif -#	ifndef FT_SCR_SIZE -#	define FT_SCR_SIZE "1920x1080" -#	endif  /*  ** ret vals: diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h new file mode 100644 index 0000000..b129206 --- /dev/null +++ b/inc/cub3d_defines.h @@ -0,0 +1,56 @@ +#	ifndef CUB3D_DEFINES_H +#	define CUB3D_DEFINES_H + +/* +** ====== KEYS ====== +*/ + +#	ifndef FT_W_KEY +#	define FT_W_KEY 13 +#	endif +#	ifndef FT_A_KEY +#	define FT_A_KEY 0 +#	endif +#	ifndef FT_S_KEY +#	define FT_S_KEY 1 +#	endif +#	ifndef FT_D_KEY +#	define FT_D_KEY 2 +#	endif +#	ifndef FT_L_ARR_KEY +#	define FT_L_ARR_KEY 123 +#	endif +#	ifndef FT_R_ARR_KEY +#	define FT_R_ARR_KEY 124 +#	endif +#	ifndef FT_ESC_KEY +#	define FT_ESC_KEY 53 +#	endif +#	ifndef FT_F1_KEY +#	define FT_F1_KEY 122 +#	endif + +/* +** ====== SCREEN ====== +*/ + +#	ifndef FT_SCR_SIZE +#	define FT_SCR_SIZE "1920x1080" +#	endif + +/* +** ====== ERROR MSG ====== +*/ + +#	define FT_ERR_MISS_ELEMENT		"Missing element:" +#	define FT_ERR_MISS_NORTH		"north side texture" +#	define FT_ERR_MISS_SOUTH		"south side texture" +#	define FT_ERR_MISS_EAST			"east side texture" +#	define FT_ERR_MISS_WEST			"west side texture" +#	define FT_ERR_MISS_SPRITE		"sprite texture" +#	define FT_ERR_MISS_RESOLUTION	"resolution" +#	define FT_ERR_MISS_FLOOR_C		"floor color" +#	define FT_ERR_MISS_CEIL_C		"floor color" +#	define FT_ERR_MISS_PLAYER_SPAWN	"player spawn" + +#	endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index eab9b7e..9dae0be 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -13,6 +13,9 @@  #	ifndef CUB3D_STRUCTS_H  #	define CUB3D_STRUCTS_H +#include <stddef.h> +#include <stdint.h> +  typedef struct		s_win  {  	void			*wlx; diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index 12da7ad..7353a0e 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -19,7 +19,7 @@ int  {  	ft_dprintf(STDERR_FILENO, "Error\n");  	ft_dprintf(STDERR_FILENO, -				"\033[1;31mMissing element: %s\033[0m\n", err); +			"\033[1;31m%s %s\033[0m\n", FT_ERR_MISS_ELEMENT, err);  	return (ft_exit(1, clist));  } @@ -27,24 +27,24 @@ int  	ft_check_missing(t_cub *clist)  {  	if (!clist->mlist->no_tex_path[0]) -		return (ft_missing_error("north side texture", clist)); +		return (ft_missing_error(FT_ERR_MISS_NORTH, clist));  	else if (!clist->mlist->so_tex_path[0]) -		return (ft_missing_error("south side texture", clist)); +		return (ft_missing_error(FT_ERR_MISS_SOUTH, clist));  	else if (!clist->mlist->ea_tex_path[0]) -		return (ft_missing_error("east side texture", clist)); +		return (ft_missing_error(FT_ERR_MISS_EAST, clist));  	else if (!clist->mlist->we_tex_path[0]) -		return (ft_missing_error("west side texture", clist)); +		return (ft_missing_error(FT_ERR_MISS_WEST, clist));  	else if (!clist->mlist->sprite_path[0]) -		return (ft_missing_error("sprite texture", clist)); +		return (ft_missing_error(FT_ERR_MISS_SPRITE, clist));  	else if (clist->wlist->x_size == 0 || clist->wlist->y_size == 0) -		return (ft_missing_error("resolution", clist)); +		return (ft_missing_error(FT_ERR_MISS_RESOLUTION, clist));  	else if (clist->f_rgb.r == -1 || clist->f_rgb.g == -1  				|| clist->f_rgb.b == -1) -		return (ft_missing_error("floor color", clist)); +		return (ft_missing_error(FT_ERR_MISS_FLOOR_C, clist));  	else if (clist->c_rgb.r == -1 || clist->c_rgb.g == -1  				|| clist->c_rgb.b == -1) -		return (ft_missing_error("ceiling color", clist)); +		return (ft_missing_error(FT_ERR_MISS_CEIL_C, clist));  	else if (clist->plist->pos_x == 0 || clist->plist->pos_y == 0) -		return (ft_missing_error("player spawn", clist)); +		return (ft_missing_error(FT_ERR_MISS_PLAYER_SPAWN, clist));  	return (0);  } | 
