Download Tutorial C Files H Files

dg_fb_putsquare

This function draw a square in a framebuffer.

Usage

void dg_fb_putsquare(dg_framebuffer_t *fb, sfVector2u position, unsigned int size, sfColor color);

Example

dg_fb_putsquare(fb, pos, 20, sfBlue);

Source code

void dg_fb_putsquare(dg_framebuffer_t *fb, sfVector2u position,
                 unsigned int size, sfColor color)
{
    for (int i = position.x; i < position.x + size; i++)
        for (int j = position.y; j < position.y + size; j++)
            dg_fb_putpx(fb, i, j, color);
}