From 8246d15c4bd1ad0905f4ecd9691a77f8046a3984 Mon Sep 17 00:00:00 2001 From: heliumhydride <34401203+heliumhydride@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:11:30 +0100 Subject: [PATCH] do cosgraph example --- TODO | 1 - examples/cosgraph.c | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/TODO b/TODO index a863b24..9b17c37 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ make a README.md fix mkline segfaults fix mkpixel x y orientation -cosgraph example snake game example complex_rotation example (use complex numbers to rotate points on a graph around the origin) diff --git a/examples/cosgraph.c b/examples/cosgraph.c index 0d9a2c9..208dd18 100644 --- a/examples/cosgraph.c +++ b/examples/cosgraph.c @@ -16,15 +16,8 @@ int main(void) { printf("\033[s"); // save cursor position - // TODO for every x from 0 to 'cols', graph the cos(x) - - /* - add_pixel(pixelmap, 0,1,1.0f); - render_pixelmap(pixelmap); - */ - for(int x = 0; x < cols; x++) { - add_pixel(pixelmap, (int)rows/2, (int)(cos(x)*10), 1.0f); + add_pixel(pixelmap, (int)(rows/2 + cos(x)*1.1), x, 1.0f); render_pixelmap(pixelmap); } return 0;