48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* fdf_init.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2017/03/16 18:55:39 by gtertysh #+# #+# */
|
|
/* Updated: 2017/03/16 18:56:00 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "fractol.h"
|
|
|
|
static t_mw *mlx_and_win_ptr_init(int x, int y)
|
|
{
|
|
t_mw *mw;
|
|
|
|
if ((mw = malloc(sizeof(t_mw))))
|
|
{
|
|
mw->mlx = mlx_init();
|
|
mw->win = mlx_new_window(mw->mlx, x, y, "FDF");
|
|
}
|
|
return (mw);
|
|
}
|
|
|
|
t_fdf *fdf_init(char *path, t_color *low, t_color *high)
|
|
{
|
|
t_fdf *fdf;
|
|
|
|
if ((fdf = malloc(sizeof(t_fdf))))
|
|
{
|
|
fdf->map = map_init(path);
|
|
fdf->map->low = low;
|
|
fdf->map->high = high;
|
|
pnt_init(fdf->map);
|
|
fdf->w_height = HEIGHT;
|
|
fdf->w_width = WIDTH;
|
|
fdf->mw = mlx_and_win_ptr_init(WIDTH, HEIGHT);
|
|
fdf->image = mlx_new_image(fdf->mw->mlx, WIDTH, HEIGHT);
|
|
fdf->image_data = mlx_get_data_addr(
|
|
fdf->image,
|
|
&fdf->bpp,
|
|
&fdf->line_size,
|
|
&fdf->endian);
|
|
}
|
|
return (fdf);
|
|
}
|