diff --git a/kubo_wall.c b/kubo_wall.c index 77ce7eb..586b4dd 100644 --- a/kubo_wall.c +++ b/kubo_wall.c @@ -43,3 +43,14 @@ bool kubo_wall_add_vertex(struct kubo_wall *wall, Vector2 vec) { Vector2 kubo_wall_get_vertex(struct kubo_wall *wall, size_t index) { return kubo_vector2_arr_get(&wall->vertices, index); } + +void kubo_wall_render(struct kubo_wall *wall) { + DrawSplineLinear(wall->vertices.data, wall->vertices.count, 10.f, BLACK); + + if (wall->state == KUBO_WALL_DRAWING) { + Vector2 mouse = GetMousePosition(); + Vector2 points[] = {wall->vertices.data[wall->vertices.count - 1], + mouse}; + DrawSplineLinear(points, 2, 10.f, BLACK); + } +} diff --git a/kubo_wall.h b/kubo_wall.h index f251ccb..976c466 100644 --- a/kubo_wall.h +++ b/kubo_wall.h @@ -45,5 +45,7 @@ void kubo_wall_cleanup(struct kubo_wall *wall); bool kubo_wall_add_vertex(struct kubo_wall *wall, Vector2 vec); Vector2 kubo_wall_get_vertex(struct kubo_wall *wall, size_t index); +void kubo_wall_render(struct kubo_wall *wall); + #endif diff --git a/kubo_window.c b/kubo_window.c index 2e5561a..273408b 100644 --- a/kubo_window.c +++ b/kubo_window.c @@ -41,16 +41,8 @@ void kubo_window_render(struct kubo_context *context) { for (int i = 0; i < context->walls.count; i++) { struct kubo_wall *wall = kubo_wall_arr_get(&context->walls, i); assert(wall != NULL); - - DrawSplineLinear(wall->vertices.data, wall->vertices.count, 10.f, - BLACK); - - if (wall->state == KUBO_WALL_DRAWING) { - Vector2 mouse = GetMousePosition(); - Vector2 points[] = {wall->vertices.data[wall->vertices.count - 1], - mouse}; - DrawSplineLinear(points, 2, 10.f, BLACK); - } + + kubo_wall_render(wall); } EndDrawing();