Allow Entities to register callbacks on mouse interaction. Based on FlxMouseEventManager by TiagoLr.
To use a MouseManager, add it to the scene, then call the add
method to add
Entities with mouse event callbacks. Multiple MouseManagers can be added to
the same scene. All entities within one MouseManager must be the same
collision type.
Constructor
Functions
add (entity : Entity, onPress : MouseCallback, onRelease : MouseCallback, onEnter : MouseCallback, onExit : MouseCallback, onWheel : MouseWheelCallback, fallThrough : Bool = false) : Entity
Adds an object to the MouseManager registry.
Parameters:
entity | ||
onPress | Callback when mouse is pressed down over this object. | |
onRelease | Callback when mouse is released over this object. | |
onEnter | Callback when mouse is this object. | |
onExit | Callback when mouse moves out of this object. | |
fallThrough | If true, other objects overlaped by this will still receive mouse events. |
addDefault (onPress : MouseCallback, onRelease : MouseCallback, onEnter : MouseCallback, onExit : MouseCallback, onWheel : MouseWheelCallback) : Void
Default callbacks to use when no other entities collide.