aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_init_winlx.c
blob: a4b7208965c041fae9f15f01dc4669c78cecb34c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <libft.h>
#include <mlx.h>
#include <cub3d.h>
#include <stdlib.h>

int
ft_init_winlx(t_win *wlist)
{
	ft_memdel(wlist->wlx);
	if (!(wlist->wlx = mlx_init()))
		return (-1);
	ft_memdel(wlist->winptr);
	if (!(wlist->winptr = (void*)malloc(wlist->x_size * wlist->y_size)))
		return (-1);
	if (!(wlist->winptr = mlx_new_window(wlist->wlx, wlist->x_size,\
										 wlist->y_size, "Cub3D")))
		return (-1);
	ft_printf("Created window of size %dx%d\n", wlist->x_size, wlist->y_size);
	return (0);
}