34 lines
626 B
C
34 lines
626 B
C
#include "fdf.h"
|
|
|
|
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_FDF *FDF;
|
|
|
|
if ((FDF = malloc(sizeof(t_FDF))))
|
|
{
|
|
FDF->map = map_init(path);
|
|
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);
|
|
}
|