summaryrefslogtreecommitdiff
path: root/examples/triangle.c
blob: 452dc94052c58148dafa7d1d0063688d8a106740 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <math.h>

#include "../sponge.h"

#define SPEED (4)
static int32_t offset = 0;

void init() {}

void draw_frame(sponge_Texture c) {
    sponge_clear(c, 0xFF000000);
    offset += SPEED;

    if (offset > 100)
        offset = -100;

    sponge_draw_triangle_col3(
        c,
        30, 30 + offset,
        c.width - 30, 50 + offset,
        30, c.height - 30 + offset,
        0xFFFF0000, 0xFF00FF00, 0xFF0000FF);
}