Example #1
0
int ft_draw_line(FBSurface *s, FTPoint *from, FTPoint *to, FTDrawGC *gc)
{
    assert (from->x == to->x || from->y == to->y);

    FTPoint p;
    int a, b, i;

    if (from->x == to->x)
    {
        a = MIN(from->y, to->y);
        b = MAX(from->y, to->y);
        p.x = from->x;

        for (i = a; i <= b; i++)
        {
            p.y = i;
            ft_draw_point(s, &p, gc);
        }
    }
    else
    {
        a = MIN(from->x, to->x);
        b = MAX(from->x, to->x);
        p.y = from->y;

        for (i = a; i <= b; i++)
        {
            p.x = i;
            ft_draw_point(s, &p, gc);
        }
    }

    return FT_SUCCESS;
}
Example #2
0
int					ft_draw_map(t_env *env)
{
	t_pos		pos;
	t_rgb		col;
	int			i;
	int			j;

	i = 0;
	while (i < HEIGTH)
	{
		j = 0;
		while (j < WIDTH)
		{
			if (env->shared_mem->game[i][j] == -1)
				col = ft_rgb_convert(39, 40, 34);
			else
				col = ft_team_color(env->shared_mem->game[i][j]);
			pos.x = j * 10;
			pos.y = i * 10;
			ft_draw_point(env, pos, col);
			j++;
		}
		i++;
	}
	return (0);
}