Fork me on GitHub
View source

package haxepunk.input

class MouseManager


extends Entity

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

View source

new () : Void

Functions

View source

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.

View source

addDefault (onPress : MouseCallback, onRelease : MouseCallback, onEnter : MouseCallback, onExit : MouseCallback, onWheel : MouseWheelCallback) : Void

Default callbacks to use when no other entities collide.

View source

clear () : Void

Removes all registered objects from the registry.

View source

getData (entity : Entity) : Null<MouseData>

View source

remove (entity : Entity) : Entity

Removes a registered object from the registry.

View source

update () : Void