Moved wall render function
This commit is contained in:
parent
aeeaab0ad7
commit
b0087c772a
3 changed files with 15 additions and 10 deletions
11
kubo_wall.c
11
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue