I'm making a grid system using computer science.
My idea is that when the mouse pointer is hovering a cell of the grid that cell should be highlighted. But, I'm having a bit of trouble.
Problem:
Lets say for simplicity a cell is 5 x 5 so half of the cell is 2.5. If the mouse is hovering at a position of 3,3 or even 1.5,3.
How can I make a mathematical formula which finds the origin of the cell which I'm hovering.
Finding the points at which the cell is being drawn, look at the picture for more detail (hopefully).
![]()


LinkBack URL
About LinkBacks

