public class PInputManager extends PBasicInputEventHandler implements PRoot.InputSource
PInputEvent
,
PRoot
Constructor and Description |
---|
PInputManager()
Creates a PInputManager and sets positions (last, current) to the origin
(0,0).
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkForMouseEnteredAndExited(PInputEvent event)
Fires events whenever the mouse moves from PNode to PNode.
|
Point2D |
getCurrentCanvasPosition()
Returns the position of the current canvas event.
|
PInputEventListener |
getKeyboardFocus()
Return the node that currently has the keyboard focus.
|
Point2D |
getLastCanvasPosition()
Returns the position on the Canvas of the last event.
|
PPickPath |
getMouseFocus()
Return the current Pick Path under the mouse focus.
|
PPickPath |
getMouseOver()
Return the node the the mouse is currently over.
|
void |
keyPressed(PInputEvent event)
Will get called whenever a key has been pressed down.
|
void |
keyReleased(PInputEvent event)
Will get called whenever a key has been released.
|
void |
keyTyped(PInputEvent event)
Will be called at the end of a full keystroke (down then up).
|
void |
mouseClicked(PInputEvent event)
Will be called at the end of a full click (mouse pressed followed by
mouse released).
|
void |
mouseDragged(PInputEvent event)
Will be called when a drag is occurring.
|
void |
mouseEntered(PInputEvent event)
Will be invoked when the mouse enters a specified region.
|
void |
mouseExited(PInputEvent event)
Will be invoked when the mouse leaves a specified region.
|
void |
mouseMoved(PInputEvent event)
Will be called when the mouse is moved.
|
void |
mousePressed(PInputEvent event)
Will be called when a mouse button is pressed down.
|
void |
mouseReleased(PInputEvent event)
Will be called when any mouse button is released.
|
void |
mouseWheelRotated(PInputEvent event)
This method is invoked when the mouse wheel is rotated.
|
void |
mouseWheelRotatedByBlock(PInputEvent event)
This method is invoked when the mouse wheel is rotated by a block.
|
void |
processEventFromCamera(InputEvent event,
int type,
PCamera camera)
Flags the given event as needing to be processed.
|
void |
processInput()
Causes the system to process any pending Input Events.
|
void |
setKeyboardFocus(PInputEventListener eventHandler)
Set the node that should receive key events.
|
void |
setMouseFocus(PPickPath path)
Sets the current Pick Path under the mouse focus.
|
void |
setMouseOver(PPickPath path)
Records the path which is directly below the mouse.
|
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, processEvent, setEventFilter
public PInputManager()
public PInputEventListener getKeyboardFocus()
public void setKeyboardFocus(PInputEventListener eventHandler)
eventHandler
- sets the keyboard event focus, may be nullpublic PPickPath getMouseFocus()
public void setMouseFocus(PPickPath path)
path
- the new mouse focuspublic PPickPath getMouseOver()
public void setMouseOver(PPickPath path)
path
- path over which the mouse has been movedpublic Point2D getLastCanvasPosition()
public Point2D getCurrentCanvasPosition()
public void keyPressed(PInputEvent event)
keyPressed
in class PBasicInputEventHandler
event
- the event representing the keystrokepublic void keyReleased(PInputEvent event)
keyReleased
in class PBasicInputEventHandler
event
- the event representing the keystrokepublic void keyTyped(PInputEvent event)
keyTyped
in class PBasicInputEventHandler
event
- object which can be queried for the event's detailspublic void mouseClicked(PInputEvent event)
mouseClicked
in class PBasicInputEventHandler
event
- object which can be queried for the event's detailspublic void mouseWheelRotated(PInputEvent event)
mouseWheelRotated
in class PBasicInputEventHandler
event
- an object that can be queries to discover the event's
detailspublic void mouseWheelRotatedByBlock(PInputEvent event)
mouseWheelRotatedByBlock
in class PBasicInputEventHandler
event
- an object that can be queries to discover the event's
detailspublic void mouseDragged(PInputEvent event)
mouseDragged
in class PBasicInputEventHandler
event
- object which can be queried for the event's detailspublic void mouseEntered(PInputEvent event)
mouseEntered
in class PBasicInputEventHandler
event
- object which can be queried for the event's detailspublic void mouseExited(PInputEvent event)
mouseExited
in class PBasicInputEventHandler
event
- object which can be queried for the event's detailspublic void mouseMoved(PInputEvent event)
mouseMoved
in class PBasicInputEventHandler
event
- object which can be queried for event detailspublic void mousePressed(PInputEvent event)
mousePressed
in class PBasicInputEventHandler
event
- object which can be queried for the event's detailspublic void mouseReleased(PInputEvent event)
mouseReleased
in class PBasicInputEventHandler
event
- object which can be queried for event detailsprotected void checkForMouseEnteredAndExited(PInputEvent event)
event
- to check to see if the top node has changed.public void processInput()
processInput
in interface PRoot.InputSource
public void processEventFromCamera(InputEvent event, int type, PCamera camera)
event
- the event to be processedtype
- type of event to be processedcamera
- camera from which the event was dispatchedCopyright © 1995-2013 Piccolo2D. All Rights Reserved.