|
Genuts API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines an interface for classes that know how to check collision between sprites.
A collision manager can manage only one playfield.
PlayField
Method Summary | |
void |
addSprite(Sprite sprite)
Adds a sprite in the check list of this collision manager. |
void |
checkAllCollisions()
Checks collisions of sprites with all other sprites in the playfield, and with the edges of the playfield. |
void |
checkCollision(Sprite sprite)
Checks collision of the given sprite with all other sprites in the playfield, and with the edges of the playfield. |
void |
drawDebug(java.awt.Graphics g)
Draws debug informations for this collision manager. |
PlayField |
getPlayfield()
Returns the playfield associated with this collision manager. |
void |
invalidateSprite(Sprite sprite)
Performs actions when a sprite is invalidate. |
void |
playfieldSizeChanged()
Informs that the size of the playfield has changed. |
boolean |
preCheckCollision(Sprite sprite)
Checks pre-collision of the given sprite with all other sprites in this playfield, and with the edges of this playfield. |
void |
removeSprite(Sprite sprite)
Removes a sprite from the check list of this collision manager. |
void |
reset()
Resets cache datas for this CollisionManager. |
void |
setPlayfield(PlayField playfield)
Sets the playfield associated with this collision manager. |
void |
validateSprite(Sprite sprite)
Performs actions when a sprite is validate. |
Method Detail |
public PlayField getPlayfield()
public void setPlayfield(PlayField playfield)
playfield
- The playfield associated with this collision manager.public void playfieldSizeChanged()
public void reset()
public boolean preCheckCollision(Sprite sprite)
If one or more pre-collisions are detected, firePreCollisionEvent(Sprite, Sprite)
is called.
sprite
- Sprite to check
true
to confirm the state of the sprite, false
otherwise.checkCollision(Sprite)
,
PlayField.firePreCollisionEvent(Sprite, Sprite)
public void checkCollision(Sprite sprite)
fireCollisionEvent(Sprite, Sprite)
is called.
sprite
- Sprite to checkPlayField.fireCollisionEvent(Sprite, Sprite)
public void checkAllCollisions()
fireCollisionEvent(Sprite, Sprite)
is called.
PlayField.fireCollisionEvent(Sprite, Sprite)
public void addSprite(Sprite sprite)
Generally, this is called by the playfield when a new sprite is added.
sprite
- Sprite to addpublic void removeSprite(Sprite sprite)
Generally, this is called by the playfield when a sprite is removed.
sprite
- Sprite to removepublic void invalidateSprite(Sprite sprite)
Generally, this is called by a sprite when Sprite.invalidate() is called.
sprite
- Sprite to invalidate.Sprite.invalidate()
public void validateSprite(Sprite sprite)
Generally, this is called by a sprite when Sprite.validate() is called.
sprite
- Sprite to validate.Sprite.validate()
public void drawDebug(java.awt.Graphics g)
g
- The graphics context to use for painting.
|
Genuts API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |