68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* solong.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/01/04 16:20:03 by cchauvet #+# #+# */
|
|
/* Updated: 2023/01/19 13:40:52 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef SOLONG_H
|
|
# define SOLONG_H
|
|
# include "../libftx/libftx.h"
|
|
# define XPM_PATH "./textures/"
|
|
# include <unistd.h>
|
|
# include <fcntl.h>
|
|
# include "../minilibx-linux/mlx.h"
|
|
# define CASE_SIZE 128
|
|
# define XPM_HEADER "\nstatic char * XFACE[] = {\""
|
|
# define RENDER_DISTANCE 4
|
|
# define NB_COLORS 100
|
|
# define HEX "0123456789abcdef"
|
|
|
|
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[2];
|
|
size_t exit_pos[2];
|
|
} t_map;
|
|
|
|
typedef struct s_data
|
|
{
|
|
void *mlx;
|
|
void *window;
|
|
void *assets[NB_COLORS * 2];
|
|
t_map *map;
|
|
size_t nb_swaps;
|
|
size_t nb_foots;
|
|
} t_data;
|
|
|
|
int ft_test_map_is_finishable(t_map *map);
|
|
int ft_exit(t_data *data);
|
|
int ft_test_map_content2(char **patern);
|
|
int ft_key(int key, t_data *data);
|
|
void ft_fill_pos(t_map *map);
|
|
char *name_generator(t_square square);
|
|
t_map *ft_getmap(char *path);
|
|
char *ft_xpm_gen_file(t_square square);
|
|
int ft_gen_assets(t_data *data);
|
|
char **ft_get_player_map(t_map map);
|
|
int ft_draw_map(t_data *data);
|
|
char *name_generator(t_square square);
|
|
int ft_color_changer(t_data *data);
|
|
void ft_draw_img(t_data *data, void *img, size_t x, size_t y);
|
|
int ft_map_is_correct(t_map *map);
|
|
#endif
|