|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.nexttext.behaviour.AbstractAction net.nexttext.behaviour.physics.PhysicsAction net.nexttext.behaviour.physics.StayInWindow
public class StayInWindow
Keep objects inside a window.
By default, StayInWindow bounces objects off the edge of the visible window. It can be configured to change the window size and object behaviour.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.nexttext.behaviour.Action |
---|
Action.ActionResult |
Constructor Summary | |
---|---|
StayInWindow(processing.core.PApplet p)
Creates a StayInWindow which constraints TextObjects to always remain within the bounds of the PApplet and to bounce off the edges. |
|
StayInWindow(processing.core.PApplet p,
boolean bounce)
Creates a StayInWindow which constraints TextObjects to always remain within the bounds of the PApplet. |
|
StayInWindow(java.awt.Rectangle bounds,
boolean bounce)
Creates a StayInWindow which constraints TextObjects to remain within the bounds of a specific rectangle. |
Method Summary | |
---|---|
Action.ActionResult |
behave(TextObject to)
Constraints the object so that it stays within the visible window. |
void |
setWindow(java.awt.Rectangle window)
Redefines the window region to constraint objects to. |
Methods inherited from class net.nexttext.behaviour.physics.PhysicsAction |
---|
applyAcceleration, applyAngularAcceleration, applyAngularForce, applyForce, getAngularVelocity, getMass, getRequiredProperties, getVelocity |
Methods inherited from class net.nexttext.behaviour.AbstractAction |
---|
behave, behave, complete, getDisplayName, makeBehaviour, properties, setDisplayName |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.nexttext.behaviour.Action |
---|
behave, behave, complete, getRequiredProperties |
Constructor Detail |
---|
public StayInWindow(processing.core.PApplet p)
p
- the parent PAppletpublic StayInWindow(processing.core.PApplet p, boolean bounce)
p
- the parent PAppletbounce
- Causes the objects to bounce off the edges if true or to
stick to the edges if false.public StayInWindow(java.awt.Rectangle bounds, boolean bounce)
bounds
- An arbitrary rectanglebounce
- Causes the objects to bounce off the edges if true or to
stick to the edges if false.Method Detail |
---|
public void setWindow(java.awt.Rectangle window)
public Action.ActionResult behave(TextObject to)
The returned ActionResult will include an event when the object encountered one of the window's edges.
behave
in interface Action
behave
in class AbstractAction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |