public class MouseEvent extends Event
Event.Type.MOUSE_ENTERED
,
Event.Type.MOUSE_MOVED
,
Event.Type.MOUSE_LEFT
,
Event.Type.MOUSE_WHEEL_MOVED
,
Event.Type.MOUSE_BUTTON_PRESSED
or
Event.Type.MOUSE_BUTTON_RELEASED
.Event.Type
Modifier and Type | Field and Description |
---|---|
Vector2i |
position
The position of the mouse pointer in pixels, relative to the window's top left corner.
|
Constructor and Description |
---|
MouseEvent(int type,
int x,
int y)
/**
Constructs a new mouse button event.
|
Modifier and Type | Method and Description |
---|---|
MouseEvent |
asMouseEvent()
Attempts to cast this event to a
MouseEvent . |
asJoystickButtonEvent, asJoystickEvent, asJoystickMoveEvent, asKeyEvent, asMouseButtonEvent, asMouseWheelEvent, asSizeEvent, asTextEvent
public final Vector2i position
public MouseEvent(int type, int x, int y)
type
- the type of the event.
This must be a valid ordinal in the Event.Type
enumeration.x
- the X coordinate of the mouse cursor relative to the window.y
- the Y coordinate of the mouse cursor relative to the window.public MouseEvent asMouseEvent()
Event
MouseEvent
.asMouseEvent
in class Event
MouseEvent
if its type is one of
Event.Type.MOUSE_ENTERED
, Event.Type.MOUSE_MOVED
,
Event.Type.MOUSE_LEFT
, Event.Type.MOUSE_BUTTON_PRESSED
,
Event.Type.MOUSE_BUTTON_RELEASED
or Event.Type.MOUSE_WHEEL_MOVED
,
null
otherwise.