context state control and wall selection

This commit is contained in:
Luka Jankovic 2025-06-24 23:07:32 +02:00
parent f768cff6d2
commit 10d243055d
6 changed files with 152 additions and 32 deletions

View file

@ -44,13 +44,18 @@ 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);
void kubo_wall_render(struct kubo_wall *wall, bool select) {
Color wall_color =
(select && wall->state == KUBO_WALL_SELECTED) ? BLUE : BLACK;
DrawSplineLinear(wall->vertices.data, wall->vertices.count, 10.f,
wall_color);
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);
DrawSplineLinear(points, 2, 10.f, wall_color);
}
}