
I need some help. I've been trying to figure this out on my own for a few days but I've come to the point where I realize I just don't know how to do this.
In the screenshot above, you can see a grid-based inventory window which is 10 x 10 in size. Each grid is 32 x 32 pixels. What I'm trying to do is, I want to know which grid is the mouse currently hovered over. I want the result to return a number from 0 to 99 (well, to be more specific, there are 100 slots, but since ACS arrays are 0-based, that would mean that the results would be from 0 to 99).
The grid is also ordered from left to right, then top to bottom. That means... as you retrieve items, the grid will first be filled from left to right... once it reaches the last grid on the right, it moves down to the next line and starts from the left again.
I haven't the slightest clue on how to achieve this. I'm horrible at maths. Please help. :(