ballworld.model.paint
Class UprightShapePaintStrategy

java.lang.Object
  extended by ballworld.model.paint.APaintStrategy
      extended by ballworld.model.paint.ShapePaintStrategy
          extended by ballworld.model.paint.UprightShapePaintStrategy
All Implemented Interfaces:
IPaintStrategy

public class UprightShapePaintStrategy
extends ShapePaintStrategy

Class that adds a paintCfg override that keeps the shape upright no matter which direction it is going.

Author:
swong

Field Summary
 
Fields inherited from class ballworld.model.paint.APaintStrategy
at
 
Fields inherited from interface ballworld.model.IPaintStrategy
NullObject
 
Constructor Summary
UprightShapePaintStrategy(java.awt.geom.AffineTransform at, java.awt.Shape shape)
          Constructor that takes both a Shape and an affine transform
UprightShapePaintStrategy(java.awt.Shape shape)
          Constructor that takes a Shape, generates its own affine transform.
 
Method Summary
protected  void paintCfg(java.awt.Graphics g, Ball host)
          Override paintCfg to add the transform needed to keep the shape upright at all times.
 
Methods inherited from class ballworld.model.paint.ShapePaintStrategy
paintXfrm
 
Methods inherited from class ballworld.model.paint.APaintStrategy
init, paint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UprightShapePaintStrategy

public UprightShapePaintStrategy(java.awt.Shape shape)
Constructor that takes a Shape, generates its own affine transform.

Parameters:
shape - The prototype shape to be painted.

UprightShapePaintStrategy

public UprightShapePaintStrategy(java.awt.geom.AffineTransform at,
                                 java.awt.Shape shape)
Constructor that takes both a Shape and an affine transform

Parameters:
at - The affine transform object to use
shape - The prototype shape to use.
Method Detail

paintCfg

protected void paintCfg(java.awt.Graphics g,
                        Ball host)
Override paintCfg to add the transform needed to keep the shape upright at all times.

Overrides:
paintCfg in class APaintStrategy
Parameters:
g - The Graphics context that will be drawn upon.
host - The Ball to be painted.