Пример #1
0
t_mlx	init_mlx(t_letubbies po)
{
	t_mlx	list;

	list.color = 0xFFFFFF;
	list.gap = 5;
	list.ori = 0;
	list.default_gap = list.gap;
	list.width_w = 1500;
	list.height_w = 1500;
	list.pos_x_image = -500;
	list.pos_y_image = -500;
	list.pas_width = 1000;
	list.pas_height = 1000;
	list.mlx = mlx_init();
	list.win = mlx_new_window(list.mlx, list.width_w, list.height_w, "FDF");
	list.xmax = po.xmax;
	list.ymax = po.ymax;
	list.po_tab = po.tab;
	list.lp = boucle_lpoint(list);
	list.width_image = list.pas_width * 2 + list.xmax * (list.gap * 2) * 3;
	list.height_image = list.pas_height * 2 + list.ymax * (list.gap * 2) * 3;
	list = ft_create_image(list);
	return (list);
}
Пример #2
0
void			change_color(t_mlx *list)
{
	list->color = list->color + 0x0F0F0F;
	mlx_clear_window(list->mlx, list->win);
	mlx_destroy_image(list->mlx, list->link);
	*list = ft_create_image(*list);
	ft_try(*list);
	mlx_put_image_to_window(list->mlx, list->win, list->link,
			list->pos_x_image, list->pos_y_image);
}
Пример #3
0
void	ft_mlx(t_data *d)
{
	t_img	bg;
	t_img	img;

	d->img = &img;
	d->bg = &bg;
	d->mlx = mlx_init();
	d->win = mlx_new_window(d->mlx, WIDTH, HEIGHT, d->info->name);
	ft_create_image(d);
	d->userx = 0;
	d->usery = 0;
	d->dir = 0;
	mlx_hook(d->win, 2, 1, key_press, d);
	mlx_hook(d->win, 3, 2, key_release, d);
	mlx_loop_hook(d->mlx, loop_hook, d);
	mlx_mouse_hook(d->win, mouse_hook, d);
	mlx_expose_hook(d->win, expose_hook, d);
	mlx_loop(d->mlx);
}