From e12b1f93c31572906134ce5dad35162a675c5132 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 29 Dec 2021 20:04:18 +0100 Subject: [PATCH] Update raygui.h --- src/raygui.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index 474af18..0e14a67 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -3272,8 +3272,9 @@ Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs) { if (CheckCollisionPointRec(mousePoint, bounds)) { - currentCell.x = (mousePoint.x - bounds.x)/spacing; - currentCell.y = (mousePoint.y - bounds.y)/spacing; + // NOTE: Cell values must be rounded to int + currentCell.x = (int)((mousePoint.x - bounds.x)/spacing); + currentCell.y = (int)((mousePoint.y - bounds.y)/spacing); } } //--------------------------------------------------------------------