context state control and wall selection
This commit is contained in:
parent
f768cff6d2
commit
10d243055d
6 changed files with 152 additions and 32 deletions
11
kubo_wall.c
11
kubo_wall.c
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue