grid and mouse snapping

This commit is contained in:
Luka Jankovic 2025-08-30 21:40:16 +02:00
parent 736829a119
commit 61986f41fa
7 changed files with 72 additions and 19 deletions

View file

@ -40,7 +40,8 @@ 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, bool select, Camera2D *camera) {
void kubo_wall_render(struct kubo_wall *wall, bool select, Camera2D *camera, Vector2 mouse) {
(void)camera;
Color wall_color =
(select && wall->state == KUBO_WALL_SELECTED) ? BLUE : BLACK;
@ -54,7 +55,7 @@ void kubo_wall_render(struct kubo_wall *wall, bool select, Camera2D *camera) {
DrawSplineLinear(points, wall->vertices.count, 10.f, wall_color);
if (wall->state == KUBO_WALL_DRAWING) {
Vector2 mouse = GetScreenToWorld2D(GetMousePosition(), *camera);
// Vector2 mouse = GetScreenToWorld2D(mouse, *camera);
Vector2 mouse_points[] = {points[wall->vertices.count - 1], mouse};
DrawSplineLinear(mouse_points, 2, 10.f, wall_color);