public class KeyAgent extends Agent
Agent
.Agent
,
MouseAgent
,
DroidKeyAgent
,
DroidTouchAgent
Modifier and Type | Field and Description |
---|---|
static int |
DOWN_KEY |
static int |
LEFT_KEY |
static int |
RIGHT_KEY |
static int |
UP_KEY |
Constructor and Description |
---|
KeyAgent(Scene scn)
Calls super on (scn,n) and sets default keyboard shortcuts.
|
Modifier and Type | Method and Description |
---|---|
static int |
keyCode(char key)
Same as
return java.awt.event.KeyEvent.getExtendedKeyCodeForChar(key) . |
void |
keyEvent(KeyEvent e)
Processing keyEvent method to be registered at the PApplet's instance.
|
Scene |
scene()
Returns the scene this object belongs to.
|
addGrabber, defaultGrabber, disableTracking, enableTracking, grabbers, hasGrabber, inputGrabber, inputHandler, isInputGrabber, isTracking, removeGrabber, removeGrabbers, resetTrackedGrabber, sensitivities, setDefaultGrabber, setTracking, shiftDefaultGrabber, toggleTracking, trackedGrabber
public static final int LEFT_KEY
public static final int RIGHT_KEY
public static final int UP_KEY
public static final int DOWN_KEY
public KeyAgent(Scene scn)
public Scene scene()
public void keyEvent(KeyEvent e)
Current implementation requires grabber objects to have a
Profile
and to implement
Grabber.checkIfGrabsInput(BogusEvent)
on a
KeyboardEvent
as follows:
public boolean checkIfGrabsInput(KeyboardEvent event) {
return profile.hasBinding(event.shortcut());
}
in this way an agent grabber will grab input as long as it defines a binding for a given triggered key shortcut. The default grabber will just have the highest precedence among all agent grabbers, provided that more than one grabber defines a binding for the same key shortcut.
public static int keyCode(char key)
return java.awt.event.KeyEvent.getExtendedKeyCodeForChar(key)
.Processing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia