done
This commit is contained in:
parent
4a58e0bef2
commit
667f6c00fb
29
srcs/main.c
29
srcs/main.c
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/02/13 16:42:55 by apommier #+# #+# */
|
||||
/* Updated: 2022/02/14 23:49:53 by apommier ### ########.fr */
|
||||
/* Updated: 2022/02/15 00:08:06 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -118,27 +118,6 @@ char **set_map(char **argv)
|
||||
return (map_tab);
|
||||
}
|
||||
|
||||
int button_press(int code, t_data *img)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
(void)code;
|
||||
printf("img in buttom = %p\n", img);
|
||||
printf("move = %d\n", img->move);
|
||||
//printf("img->mlx = %p\n", img->mlx);
|
||||
i = 0;
|
||||
mlx_destroy_window(img->mlx, img->mlx_win);
|
||||
mlx_destroy_display(img->mlx);
|
||||
if (img->mlx)
|
||||
free(img->mlx);
|
||||
while (img->map_tab[i])
|
||||
free(img->map_tab[i++]);
|
||||
free(img->map_tab);
|
||||
//quit_game(img);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
t_data img;
|
||||
@ -159,11 +138,7 @@ int main(int argc, char **argv)
|
||||
img.mlx_win = mlx_new_window(img.mlx, ft_strlen(img.map_tab[0]) * 32,
|
||||
height * 32, "Hungry Bear");
|
||||
print_map(img.map_tab, &img);
|
||||
printf("img in main= %p\n", &img);
|
||||
//mlx_hook(img.mlx_win, DestroyNotify, NoEventMask, &button_press, &img);
|
||||
|
||||
mlx_hook(img.mlx_win, 2, 1L << 0, &key_press, &img);
|
||||
mlx_hook(img.mlx_win, 33, 1L << 17, &button_press, &img);
|
||||
//mlx_key_hook(img.mlx_win, &key_press, &img);
|
||||
mlx_hook(img.mlx_win, 17, 0L, &quit_game, &img);
|
||||
mlx_loop(img.mlx);
|
||||
}
|
||||
|
||||
BIN
srcs/main.o
BIN
srcs/main.o
Binary file not shown.
BIN
srcs/parsing.o
BIN
srcs/parsing.o
Binary file not shown.
BIN
srcs/print_map.o
BIN
srcs/print_map.o
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/02/13 16:30:59 by apommier #+# #+# */
|
||||
/* Updated: 2022/02/14 00:37:07 by apommier ### ########.fr */
|
||||
/* Updated: 2022/02/15 00:02:48 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -51,7 +51,7 @@ void check_arg(int argc, char **argv);
|
||||
//utils
|
||||
void ft_error(char *error_msg, char **map);
|
||||
int check_map(char **map);
|
||||
void quit_game(t_data *img);
|
||||
int quit_game(t_data *img);
|
||||
int key_press(int code, t_data *img);
|
||||
int *choose_bear(t_data *img);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/02/13 23:37:02 by apommier #+# #+# */
|
||||
/* Updated: 2022/02/14 23:49:04 by apommier ### ########.fr */
|
||||
/* Updated: 2022/02/15 00:08:44 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -41,7 +41,7 @@ int check_map(char **map)
|
||||
return (1);
|
||||
}
|
||||
|
||||
void quit_game(t_data *img)
|
||||
int quit_game(t_data *img)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -55,6 +55,7 @@ void quit_game(t_data *img)
|
||||
free(img->map_tab[i++]);
|
||||
free(img->map_tab);
|
||||
exit(1);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int key_press(int code, t_data *img)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user