diff options
| author | dario-loi <loi.1940849@studenti.uniroma1.it> | 2024-11-26 22:38:38 +0100 |
|---|---|---|
| committer | dario-loi <loi.1940849@studenti.uniroma1.it> | 2024-11-26 22:38:38 +0100 |
| commit | 7016d298ed1a5faf274ea5d300d7aea9dbc68b56 (patch) | |
| tree | 3f35ff268ba62d5d801f6287d1ee9f040bcb7e1e /examples/circle.c | |
| parent | 51b1a6304a7bc832ac2998e2e123c63894cb9ac4 (diff) | |
Outline and filled circles, suppressed warnings
Diffstat (limited to 'examples/circle.c')
| -rw-r--r-- | examples/circle.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/circle.c b/examples/circle.c new file mode 100644 index 0000000..40ad800 --- /dev/null +++ b/examples/circle.c @@ -0,0 +1,32 @@ +#define FBGL_IMPLEMENTATION +#include "fbgl.h" + +int main(void) +{ + fbgl_t buffer; + if (fbgl_init("/dev/fb0", &buffer) == -1) { + fprintf(stdout, "Error: could not open framebuffer device\n"); + return -1; + } + + fbgl_point_t circ_center = { 960, 540 }; + + fbgl_set_bg(&buffer, 0x00FF0000); + uint32_t i = 0; + while (true) { + circ_center.x = 960 + 200 * cos(i * M_PI / 180); + circ_center.y = 540 + 200 * sin(i * M_PI / 180); + + fbgl_draw_circle_outline(circ_center.x - 240, + circ_center.y - 240, 40, 0xFFFFFF, + &buffer); + i = (i + 1) % 360; + fbgl_draw_circle_filled(480, 540, 40, 0xFFFFFF, &buffer); + usleep(10000); + } + + while (1) { + } + + return 0; +} |
