diff options
| author | kotorifan <kotorifan05@gmail.com> | 2026-04-21 22:33:00 +0200 |
|---|---|---|
| committer | kotorifan <kotorifan05@gmail.com> | 2026-04-21 22:33:00 +0200 |
| commit | a2c8cd78cdb0532496ee6487878b7c52a782e871 (patch) | |
| tree | d3b5f3f33f82edbfea49812aeaaa7d7b04bda2d3 /src/graphics.c | |
| parent | 1efdb8ab18042d9efc7c2e6addf7f414fbee5590 (diff) | |
| download | trashbinphysics-a2c8cd78cdb0532496ee6487878b7c52a782e871.tar.gz | |
Doesn't compile yet, saving for just in case
Diffstat (limited to 'src/graphics.c')
| -rw-r--r-- | src/graphics.c | 34 |
1 files changed, 28 insertions, 6 deletions
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(); +} |
