
Andre W B Furtado wrote:
With the mouseFunc callback, it is very easy to recognize if the user has clicked in a point that belongs to a square: [...] I'm trying to do the same using module UserInput.hs. [...]
Sven Panne wrote:
First of all, I've never imagined that anybody would actually have a deeper look at examples/misc... :-)
Actually, I think module UserInput is the best solution for FunGEn to deal with input events...
My suggestion is to [...] Does this help?
I used a similar though: I modified the Key data. Now the KeyMouse is: KeyMouse MouseButton MouseRegion Where MouseRegion is: data MouseRegion = Point Int Int | RectangleArea (Int,Int) (Int,Int) Orientation | CircleArea (Int,Int) Float Orientation | PolygonArea [(Int,Int)] Orientation | Anywhere and data Orientation = Inside | Outside Now it is possible to check if the used has clicked inside/outside a pre-defined region, such as a circle, a rectangle or other convex polygon. If no specific region is desired, "Anywhere" can be used. Finally, it is also possible to check if the point clicked is an exact point in the screen (using "Point x y"). I'm sending this UserInput upgrade attached. Perhaps Sven would like to add it to the next release of HOpenGL? :) Cheers, -- Andre