From a2c8cd78cdb0532496ee6487878b7c52a782e871 Mon Sep 17 00:00:00 2001 From: kotorifan Date: Tue, 21 Apr 2026 22:33:00 +0200 Subject: Doesn't compile yet, saving for just in case --- src/graphics.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/graphics.c') diff --git a/src/graphics.c b/src/graphics.c index ccc3fa7..42a06cd 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -30,8 +30,9 @@ void clear_graphics(const Color color) ClearBackground(color); } -void draw_graphics_object(const object_t* obj, Color color) +void draw_graphics_object(const object_t* obj) { + const Color color = obj->color; if(!obj->registered) return; Vector2 pos = obj->pos; @@ -51,14 +52,35 @@ void draw_graphics_object(const object_t* obj, Color color) (Vector2){obj->size_x, obj->size_y}, color); break; } - } -void draw_graphics_objects(const object_t* world, uint32_t count, Color color) +void draw_graphics_objects(const object_t* world, uint32_t count) { - + for (uint32_t iter = 0; iter < count, i++) + { + if(world[iter].registered) draw_graphics_object(&world[i]); + } } +void draw_graphics_info(uint32_t fps, uint32_t objs, uint32_t max_objs) +{ + char buffer[128]; + snprintf(buffer, sizeof(buffer), "FPS: %d", fps; + DrawText(buffer, 10, 10, 20, BLACK); + snprintf(buffer, sizeof(buffer), "OBJ: %d/%d", objs, max_objs); + DrawText(buffer, 10, 35, 20, BLACK); + DrawText("ESC: Exit", 10, 60, 20, BLACK); + DrawText("R: Random velocity", 10, 85, 20, BLACK); + DrawText("G: Random gravity", 10, 110, 20, BLACK); + DrawText("C: Clear screen", 10, 135, 20, BLACK); + DrawText("RCLICK: Push object", 10, 160, 20, BLACK); + DrawText("LCLICK: Add object", 10, 185, 20, BLACK); + DrawText("1: Spawn Circle", 10, 210, 20, BLACK); + DrawText("2: Spawn Square", 10, 235, 20, BLACK); + DrawText("3: Spawn Rectangle", 10, 260, 20, BLACK); +} -void draw_graphics_info(uint32_t fps, uint32_t objs, uint32_t max_objs); -bool should_close_graphics(void); +bool should_close_graphics(void) +{ + return WindowShouldClose(); +} -- cgit v1.3