/* ************************************************************************** */
/*                                                                            */
/*                                                        ::::::::            */
/*   initialize.c                                       :+:    :+:            */
/*                                                     +:+                    */
/*   By: qmennen <qmennen@student.codam.nl>           +#+                     */
/*                                                   +#+                      */
/*   Created: 2025/04/22 17:08:26 by qmennen       #+#    #+#                 */
/*   Updated: 2025/05/07 11:35:18 by whaffman      ########   odam.nl         */
/*                                                                            */
/* ************************************************************************** */

#include "cub3d.h"

int	initialize_cub3d(t_game **game, const char *mapfile)
{
	if (!game_create(game))
		return (FAILURE);
	if (!player_create(game))
		return (FAILURE);
	if (!map_create(game, mapfile))
		return (FAILURE);
	if (!texture_load(*game))
		return (FAILURE);
	if (!screen_create(game))
		return (FAILURE);
	if (!keyboard_create(game))
		return (FAILURE);
	if (!screen_display((*game)->screen))
		return (FAILURE);
	mlx_key_hook((*game)->screen->mlx, keyhandle, *game);
	mlx_loop_hook((*game)->screen->mlx, game_loop, *game);
	return (SUCCESS);
}
