Package playn.core
Class Mouse
java.lang.Object
playn.core.Mouse
Defines and dispatches mouse events.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe event dispatched for mouse input.static classA slot which only dispatches onMouse.ButtonEvents.static classThe base class for all mouse events.static classAn event dispatched when the mouse is moved.static classA slot which only dispatches onMouse.MotionEvents.static classAn event dispatched when the mouse wheel is scrolled.static classA slot which only dispatches onMouse.WheelEvents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Mouse.ButtonEventbuttonEvents(Mouse.Event event) Checks whethereventis aButtonEventand returns it (casted appropriately) if so.static Mouse.MotionEventmotionEvents(Mouse.Event event) Checks whethereventis aMotionEventand returns it (casted appropriately) if so.static Mouse.WheelEventwheelEvents(Mouse.Event event) Checks whethereventis aWheelEventand returns it (casted appropriately) if so.
-
Constructor Details
-
Mouse
public Mouse()
-
-
Method Details
-
buttonEvents
Checks whethereventis aButtonEventand returns it (casted appropriately) if so. Returnsnullotherwise. Use it to obtain only button events like so:Input.mouseEvents.collect(Mouse::buttonEvents).connect(event -> { // handle button events here (event has type ButtonEvent) }); -
wheelEvents
Checks whethereventis aWheelEventand returns it (casted appropriately) if so. Returnsnullotherwise. Use it to obtain only wheel events like so:Input.mouseEvents.collect(Mouse::wheelEvents).connect(event -> { // handle wheel events here (event has type WheelEvent) }); -
motionEvents
Checks whethereventis aMotionEventand returns it (casted appropriately) if so. Returnsnullotherwise. Use it to obtain only motion events like so:Input.mouseEvents.collect(Mouse::motionEvents).connect(event -> { // handle motion events here (event has type MotionEvent) });
-