ratalaika / angel-engine

Automatically exported from code.google.com/p/angel-engine
0 stars 0 forks source link

Slightly better mouse support #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

As far as I can see reading the source, currently Angel sends mouse events to 
all listeners in unspecified order. With this behavior I find it very difficult 
to implement mouse support in my game. It's controlled almost only by mouse, in 
a manner similar to RTS games. So I have actors at various layers that all can 
be clicked, but what I don't want is that two overlapping actors are both 
clicked at the same time. Currently in Angel, two overlapping actors are both 
clicked and I don't see a way around it.

So I suggest the following extension:

Angel should send mouse events by layer (from top layer to bottom layer). And 
mouse event methods should return bool saying whether the event is considered 
consumed. So if some actor at top layer wants to handle the event, it will 
return true. At this point Angel breaks the loop and the event is not delivered 
to other actors (for instance those at deeper layers).

Original issue reported on code.google.com by rhy...@rhywek.com on 3 Mar 2011 at 4:43

GoogleCodeExporter commented 9 years ago
If you need this level of control, you should be handling the mouse events in a 
single place, like a GameManager class. 

Original comment by lieseg...@gmail.com on 8 Mar 2011 at 4:07