
With the mouseFunc callback, it is very easy to recognize if the user has clicked in a point that belongs to a square:
mouse :: MouseAction mouse (WindowPosition x y) _ = -- check if (x,y) is inside the square
I'm trying to do the same using module UserInput.hs (you can find it in the "Misc" directory), but I'm not succeeding. The problem is that, when you use UserInput, you need to bind an input event to an action, such as:
bindKey (KeyMouse LeftButton) Press (Just quitProgram)
I changed the definition of the KeyMouse construct to
KeyMouse MouseButton Windowposition
rather than only
KeyMouse MouseButton
but this still doesn't solve my problem. Does anyone have an idea? The only think I can do by now is to bind ALL the points of the square to the desired action, but this is surely not the best solution... Thanks a lot, -- Andre