From 60699af63f92f43cc4b4b9e3050fcdd2a8468281 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 10 Apr 2019 15:14:00 -0400 Subject: add opengl fronend, remove sdl frontend, refactor build system --- .../CEdev/examples/gfx_floodfill/src/main.c | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/gfx_floodfill/src/main.c (limited to 'frontends/calculator/CEdev/examples/gfx_floodfill/src') diff --git a/frontends/calculator/CEdev/examples/gfx_floodfill/src/main.c b/frontends/calculator/CEdev/examples/gfx_floodfill/src/main.c new file mode 100644 index 0000000..31a2090 --- /dev/null +++ b/frontends/calculator/CEdev/examples/gfx_floodfill/src/main.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +void main(void) { + int pts[10], i; + + int rx = 100; + int ry = 100; + int cx = LCD_WIDTH / 2; + int cy = LCD_HEIGHT / 2; + + /* Build the coordinates of the polygon */ + double theta = -M_PI / 2; + double dtheta = 4 * M_PI / 5; + for (i = 0; i < 10; i += 2) { + pts[i+0] = (int)(cx + rx * cos(theta)), + pts[i+1] = (int)(cy + ry * sin(theta)); + theta += dtheta; + } + + /* Initialize the 8bpp graphics */ + gfx_Begin(); + + /* Set up the palette */ + gfx_SetColor(gfx_black); + + /* Draw a polygon on the buffer */ + gfx_Polygon(pts, 5); + + /* Pause */ + while (!os_GetCSC()); + + /* Flood fill the rest of the screen */ + gfx_FloodFill(0, 0, 0); + + /* Pause */ + while (!os_GetCSC()); + + /* Close the graphics */ + gfx_End(); +} -- cgit v1.2.3-101-g0448