Called when a user clicks on the screen
A reference to the active engine
The position of the click
The list of sprites under the click, if capture is enabled
true if Sprite.onClick
method should be called in DELEGATE mode
Generated using TypeDoc
Every Screen interested in click events must implement this interface (Except when DELEGATE mode is used). Click event listener must be activated in Engine :
// Not interested in clicked sprites engine.enableMouseControl(); // Equivalent to engine.enableMouseControl(MouseEventType.BASIC);
It's possible to capture the list of sprites clicked by setting the optional argument to true
// Capture sprites engine.enableMouseControl(MouseEventType.SPRITES);
Sprites may also manage their behaviour themselves
// Capture sprites engine.enableMouseControl(MouseEventType.DELEGATE);
When
MouseEventType.DELEGATE
is used,Screen
needn't implementClickListener
interface To enforce declaration of interface, useMouseEventType.DELEGATE_STRICT
. Screen declaration ofonClick
is called BEFORE any sprite, can cancel delegation by returningfalse
.