Package | Description |
---|---|
ballworld.model | |
ballworld.model.paint | |
ballworld.model.paint.strategy | |
ballworld.model.strategy |
Modifier and Type | Method and Description |
---|---|
void |
IBallCmd.apply(Ball context,
Dispatcher disp)
The method run by the ball's update method which is called when the ball is updated by the dispatcher.
|
void |
IPaintStrategy.init(Ball host)
Initializes the given ball.
|
void |
IPaintStrategy.paint(java.awt.Graphics g,
Ball host)
Paints the host onto the given Graphics context.
|
void |
IUpdateStrategy.updateState(Ball context,
Dispatcher disp)
Abstract method to update the state of a ball
|
Modifier and Type | Method and Description |
---|---|
void |
MultiPaintStrategy.init(Ball host)
Delegates to all the IPaintStrategies in the composite.
|
void |
ImagePaintStrategy.init(Ball host)
Initializes the internal ImageObserver reference from the host Ball Also
calculates the net scale factor for the image.
|
void |
APaintStrategy.init(Ball context)
By default, do nothing for initialization.
|
void |
ADecoratorPaintStrategy.init(Ball host)
Default behavior is to simply delegate to the decoree's init method
|
void |
APaintStrategy.paint(java.awt.Graphics g,
Ball host)
Paints on the given graphics context using the color, scale and
direction provided by the host.
|
void |
ADecoratorPaintStrategy.paint(java.awt.Graphics g,
Ball host)
Default behavior is to simply delegate to the decoree's paint method
|
protected void |
UprightShapePaintStrategy.paintCfg(java.awt.Graphics g,
Ball host)
Override paintCfg to add the transform needed to
keep the shape upright at all times.
|
protected void |
UprightImagePaintStrategy.paintCfg(java.awt.Graphics g,
Ball host)
Augments the inherited paint method to add flipping of the image to keep
it upright whenever the ball is going towards the left.
|
protected void |
APaintStrategy.paintCfg(java.awt.Graphics g,
Ball host)
Used for doing additional configurations by a subclass.
|
void |
ShapePaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Paints the shape on the given Graphics context using the
supplied AffineTransform.
|
void |
MultiPaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Delegates to all the IPaintStrategies in the composite.
|
void |
ImagePaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Draws the image on the given Graphics context using the given affine
transform in combination with the local affine transform.
|
void |
FixedColorDecoratorPaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at) |
abstract void |
APaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Paints the host onto the given Graphics context.
|
void |
AnimatePaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Paints the currently indexed paint strategy on the given Graphics context
using the supplied AffineTransform.
|
void |
ADecoratorPaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Default behavior is to simply delegate to the decoree's paintXfrm method
|
Modifier and Type | Method and Description |
---|---|
void |
SquarePaintStrategy.init(Ball context)
By default, do nothing for initialization.
|
void |
BallPaintStrategy.init(Ball context)
By default, do nothing for initialization.
|
void |
SquarePaintStrategy.paint(java.awt.Graphics g,
Ball host)
Paints a square on the given graphics context using the color and radius
provided by the host.
|
void |
BallPaintStrategy.paint(java.awt.Graphics g,
Ball host)
Paints on the given graphics context using the color, scale and
direction provided by the host.
|
protected void |
SharkImagePaintStrategy.paintCfg(java.awt.Graphics g,
Ball host)
This is just provided as an easy means to demonstrate the effects of flipping the image
to keep the image upright.
|
protected void |
NiceFishPaintStrategy.paintCfg(java.awt.Graphics g,
Ball host)
Override paintCfg to add the transform needed to
keep the fish upright at all times.
|
void |
BallPaintStrategy.paintXfrm(java.awt.Graphics g,
Ball host,
java.awt.geom.AffineTransform at)
Paints a transformed circle, as per the given AffineTransform
Uses color already set in Graphics context
|
Modifier and Type | Method and Description |
---|---|
void |
WanderStrategy.updateState(Ball context,
Dispatcher disp)
Add random values to both the x and y components of the velocity of hte context ball.
|
void |
SwitcherStrategy.updateState(Ball context,
Dispatcher disp)
Delegates to the decoree strategy as the context's strategy.
|
void |
StraightStrategy.updateState(Ball context,
Dispatcher disp)
No-op.
|
void |
MultiStrategy.updateState(Ball context,
Dispatcher disp)
Update each composee strategy in turn.
|
void |
DrunkenStrategy.updateState(Ball context,
Dispatcher disp)
Randomly select one of the possible strategies and run it as the strategy
for the context.
|
void |
CurveStrategy.updateState(Ball context,
Dispatcher disp)
Rotate the context's velocity by the turning angle
|
void |
ColorStrategy.updateState(Ball context,
Dispatcher disp)
Set the context's color to a random color value.
|
void |
Change2Strategy.updateState(Ball context,
Dispatcher disp)
Do nothing unless the count has gone to zero, then change the context's
strategy
|
void |
Change1Strategy.updateState(Ball context,
Dispatcher disp)
Run all three composee strategies and if the count goes to zero, change the context's strategy.
|
void |
BreathingStrategy.updateState(Ball context,
Dispatcher disp)
Set the context's radius to the next value in the sinusoid.
|