42_cube3D/game/game.c
Etienne Rey-bethbeder da452769c2 _
2023-05-02 15:39:16 +02:00

39 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* game.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/26 12:59:53 by erey-bet #+# #+# */
/* Updated: 2023/04/28 16:23:57 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
#include "game.h"
int start_game(t_map *map)
{
t_game game;
if (init(map, &game))
return (1);
game.window = mlx_new_image(game.mlx, WIDTH, HEIGHT);
if (!game.window)
{
mlx_close_window(game.mlx);
return(1);
}
if (mlx_image_to_window(game.mlx, game.window, 0, 0) == -1)
{
mlx_close_window(game.mlx);
return(1);
}
mlx_key_hook(game.mlx, manage, &game);
mlx_loop(game.mlx);
mlx_terminate(game.mlx);
return (0);
}