/ fdf / fdf / srcs / init2.c
init2.c
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   init2.c                                            :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: gychoi <gychoi@student.42seoul.kr>         +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2022/12/31 23:33:02 by gychoi            #+#    #+#             */
 9  /*   Updated: 2023/01/01 01:39:19 by gychoi           ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #include "fdf.h"
14  
15  void	init_draw(t_fdf *fdf)
16  {
17  	if (fdf->img != NULL)
18  		mlx_destroy_image(fdf->mlx, fdf->img);
19  	fdf->img = mlx_new_image(fdf->mlx, SCREEN_WIDTH, SCREEN_HEIGHT);
20  	if (fdf->img == NULL)
21  		fdf_error("Error: mlx ");
22  	fdf->addr = mlx_get_data_addr(fdf->img, &fdf->bpp, \
23  		&fdf->line_len, &fdf->endian);
24  	if (fdf->addr == NULL)
25  		fdf_error("Error: mlx ");
26  }