示例#1
0
文件: draw_line.c 项目: vquesnel/FdF
static void		check_lines(t_env *env, t_node *start, t_node *end)
{
	t_node		*tmp;
	t_node		*tmp2;

	tmp = (env->proj == 0) ? isometric(env, start) : parallel(env, start);
	tmp2 = (env->proj == 0) ? isometric(env, end) : parallel(env, end);
	if ((tmp->x - tmp2->x) == 0)
		draw_vertical(env, tmp, tmp2);
	else
		check_affine(env, tmp, tmp2);
}
示例#2
0
文件: drawline.c 项目: Horsell/42
void	draw_grid(t_env *e, t_point **grid, int i, int j)
{
	grid = map_to_point(e);
	grid = (e->proj == 0) ? isometric(grid, e) : parallel(grid, e);
	i = 0;
	while ((i + 1) < e->map[0][0] - 1)
	{
		j = 0;
		while ((j + 1) < e->map[i + 1][0] - 1)
		{
			(grid[i][j + 1].x) ? putl(e, grid[i][j], grid[i][j + 1]) : 1;
			(grid[i + 1][j].x) ? putl(e, grid[i][j], grid[i + 1][j]) : 1;
			if (j + 1 == e->map[i + 1][0] - 2
				&& e->map[i + 1][0] <= e->map[i + 2][0])
				putl(e, grid[i][j + 1], grid[i + 1][j + 1]);
			if (i + 1 == e->map[0][0] - 2)
				putl(e, grid[i + 1][j], grid[i + 1][j + 1]);
			j++;
		}
		i++;
	}
	mlx_put_image_to_window(e->mlx, e->win, e->img, 0, 0);
	print_state(e);
	mlx_do_sync(e->mlx);
}