Basically, I have a NumPy array of rectangles that store their colour and position.
I want to be able to compare my mouse position and clicked on the rectangle's position and get the index or the object itself from the array.
Do I have to iterate through every square in the array and compare item's coordinates?
The structure looks like:
Cube[Face][Horizontal-Line][Square] = np.array([colour, coordinates])
What's the most efficient way to do it? I'm thinking of using colliderect()
method, but I don't know how to implement it.