71 lines
3.6 KiB
C
71 lines
3.6 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* solong.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/01/04 16:20:03 by cchauvet #+# #+# */
|
|
/* Updated: 2023/01/08 16:43:22 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef SOLONG_H
|
|
# define SOLONG_H
|
|
# include "libftx/libftx.h"
|
|
# define XPM_PATH "./textures/"
|
|
# include <stdio.h>
|
|
# include <unistd.h>
|
|
# include <fcntl.h>
|
|
# include "minilibx-linux/mlx.h"
|
|
# define CASE_SIZE 64
|
|
# define XPM_HEADER "\nstatic char * XFACE[] = {\""
|
|
# define COLORS "black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen"
|
|
# define NB_COLORS 100
|
|
# define RENDER_DISTANCE 5
|
|
# define WINDOW_SIZE (RENDER_DISTANCE * 2 + 1) * CASE_SIZE
|
|
|
|
typedef struct s_square
|
|
{
|
|
char *color;
|
|
size_t size;
|
|
} t_square;
|
|
|
|
typedef struct s_map
|
|
{
|
|
size_t x_len;
|
|
size_t y_len;
|
|
size_t nb_collectable;
|
|
char **patern;
|
|
size_t player_pos[3];
|
|
size_t exit[3];
|
|
} t_map;
|
|
|
|
typedef struct s_data
|
|
{
|
|
void *mlx;
|
|
void *window;
|
|
char *bcolor;
|
|
char *pcolor;
|
|
char *ccolor;
|
|
char *wcolor;
|
|
char *ecolor;
|
|
size_t size;
|
|
size_t nb_color_swap;
|
|
} t_data;
|
|
|
|
char *name_generator(t_square square);
|
|
t_map *ft_getmap(char *path);
|
|
void ft_freer_ultimate(size_t len, ...);
|
|
void ft_freer_tab_ultimate(size_t len, ...);
|
|
char *ft_gen_xpm_file(t_square);
|
|
char *ft_xpm_gen_file(t_square square);
|
|
char **ft_readfile(char *path);
|
|
int ft_map_is_correct(t_map *map);
|
|
int ft_gen_assets(void);
|
|
char **ft_get_player_map(t_map map);
|
|
int ft_draw_map(t_data *data, t_map *map);
|
|
char *name_generator(t_square square);
|
|
int ft_color_changer(t_data *data);
|
|
#endif
|