de.unifreiburg.twodeedoo.scene
Class AbstractPuppet

java.lang.Object
  extended by de.unifreiburg.twodeedoo.scene.AbstractPuppet
All Implemented Interfaces:
IPuppet, IPainter
Direct Known Subclasses:
MultiImagePartPuppet, SimpleTextPuppet

public abstract class AbstractPuppet
extends java.lang.Object
implements IPuppet

Implementation base for IPuppets.

Author:
anton

Field Summary
 
Fields inherited from interface de.unifreiburg.twodeedoo.scene.IPuppet
NULL_OBJECT
 
Constructor Summary
AbstractPuppet(int x, int y)
          Initialize coordinates.
 
Method Summary
 int getX()
          X coordinate
 int getY()
          Y coordinate
 void moveAbs(int x, int y)
          Move to a position on scene.
abstract  void paint(java.awt.Graphics g)
          Paint to this graphics.
 void removeFromScene()
          Remove me from my containing puppet.
 void setContainingScene(IScene scene)
          Update my containment
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPuppet

public AbstractPuppet(int x,
                      int y)
Initialize coordinates.

Parameters:
x - reference point position's x in scene units
y - reference point position's y in scene units
Method Detail

moveAbs

public void moveAbs(int x,
                    int y)
Move to a position on scene.

Specified by:
moveAbs in interface IPuppet
Parameters:
x - scene x coordinate of reference point, scene units
y - scene y coordinate of reference point, scene units

getX

public int getX()
Description copied from interface: IPuppet
X coordinate

Specified by:
getX in interface IPuppet
Returns:
x coordinate in scene units
See Also:
IPuppet.getX()

getY

public int getY()
Description copied from interface: IPuppet
Y coordinate

Specified by:
getY in interface IPuppet
Returns:
y coordinate in scene units
See Also:
IPuppet.getY()

paint

public abstract void paint(java.awt.Graphics g)
Paint to this graphics.

Specified by:
paint in interface IPainter
Parameters:
g - some graphics context.

removeFromScene

public void removeFromScene()
Remove me from my containing puppet.

Specified by:
removeFromScene in interface IPuppet
See Also:
IPuppet.removeFromScene()

setContainingScene

public void setContainingScene(IScene scene)
Update my containment

Specified by:
setContainingScene in interface IPuppet
Parameters:
scene - the new scene. Could be a non-displaying scene.
See Also:
IPuppet.setContainingScene(de.unifreiburg.twodeedoo.scene.IScene)