Class EventManager
-
- All Implemented Interfaces:
public final class EventManagerHandles all events and passes them to the correct components/layouts.
-
-
Constructor Summary
Constructors Constructor Description EventManager(PolyUI polyUI)
-
Method Summary
Modifier and Type Method Description final DrawablegetMouseOver()final DrawablegetPrimaryCandidate()final FloatgetMouseX()final FloatgetMouseY()final ShortgetKeyModifiers()final BooleangetMouseDown()weather or not the left button/primary click is DOWN (aka repeating) final UnitkeyTyped(Character key)This method should be called when a printable key is typed. final UnitkeyDown(Keys key)This method should be called when a non-printable, but representable key is pressed. final UnitkeyDown(Integer code)This method should be called when a non-representable key is pressed. final UnitkeyUp(Keys key)This method should be called when a non-printable, but representable key is released. final UnitkeyUp(Integer code)This method should be called when a non-representable key is released. final UnitrecalculateMousePos()Internal function that will force the mouse position to be updated. final Unitdrop(Drawable drawable, Boolean withChildren)Internal function that will forcefully drop the given drawable from event tracking. final UnitaddModifier(Short modifier)add a modifier to the current keyModifiers. final UnitremoveModifier(Short modifier)remove a modifier from the current keyModifiers. final UnitclearModifiers()Clear the current keyModifiers. final DrawableprocessCandidate(Drawable drawable, Float x, Float y)Internal method for drawables, tracking it if it does not consume the events. final UnitmouseMoved(Float x, Float y)call this function to update the mouse position. final UnitmousePressed(Integer button)final UnitmouseReleased(Integer button)call this function when a mouse button is released. final BooleantryFocus(Drawable drawable)try to focus a drawable, and return true if it was successful. final UnitmouseScrolled(Integer amountX, Integer amountY)call this function when the mouse is scrolled. final Booleandispatch(Event event)Dispatch an event to this PolyUI instance, and it will be given to any tracked drawable. -
-
Constructor Detail
-
EventManager
EventManager(PolyUI polyUI)
- Parameters:
polyUI- The PolyUI instance to use.
-
-
Method Detail
-
getMouseOver
final Drawable getMouseOver()
-
getPrimaryCandidate
final Drawable getPrimaryCandidate()
-
getKeyModifiers
final Short getKeyModifiers()
-
getMouseDown
final Boolean getMouseDown()
weather or not the left button/primary click is DOWN (aka repeating)
-
keyTyped
final Unit keyTyped(Character key)
This method should be called when a printable key is typed. This key should be mapped to the user's keyboard layout!
-
keyDown
final Unit keyDown(Keys key)
This method should be called when a non-printable, but representable key is pressed.
-
keyDown
final Unit keyDown(Integer code)
This method should be called when a non-representable key is pressed.
This is used solely for keybinding, and so the key can be any value, as long as it is consistent, and unique to that key.
-
keyUp
final Unit keyUp(Keys key)
This method should be called when a non-printable, but representable key is released.
-
keyUp
final Unit keyUp(Integer code)
This method should be called when a non-representable key is released.
This is used solely for keybinding, and so the key can be any value, as long as it is consistent, and unique to that key.
-
recalculateMousePos
@ApiStatus.Internal() final Unit recalculateMousePos()
Internal function that will force the mouse position to be updated.
- Since:
0.18.5
-
drop
@ApiStatus.Internal() final Unit drop(Drawable drawable, Boolean withChildren)
Internal function that will forcefully drop the given drawable from event tracking.
-
addModifier
final Unit addModifier(Short modifier)
add a modifier to the current keyModifiers.
-
removeModifier
final Unit removeModifier(Short modifier)
remove a modifier from the current keyModifiers.
-
clearModifiers
final Unit clearModifiers()
Clear the current keyModifiers.
- Since:
0.20.1
-
processCandidate
@ApiStatus.Internal() final Drawable processCandidate(Drawable drawable, Float x, Float y)
Internal method for drawables, tracking it if it does not consume the events.
This is used for event dispatching.
-
mouseMoved
final Unit mouseMoved(Float x, Float y)
call this function to update the mouse position.
-
mousePressed
final Unit mousePressed(Integer button)
-
mouseReleased
final Unit mouseReleased(Integer button)
call this function when a mouse button is released.
-
tryFocus
final Boolean tryFocus(Drawable drawable)
try to focus a drawable, and return true if it was successful.
-
mouseScrolled
final Unit mouseScrolled(Integer amountX, Integer amountY)
call this function when the mouse is scrolled.
-
-
-
-