|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfang2.core.TransformerAdapter
public class TransformerAdapter
The base class for all next generation transformers. Transformers are
"animators" which can be attached to a sprite. While updating state
during each video game loop, FANG calls advance(double) for
every TransformerAdapter-derived class in the system. The
transformer also gets a chance, during each frame of the game, to
modify the Sprite with which it is associated. The updateSprite(Sprite) method is called each frame.
By default, updateSprite(Sprite) updates the location,
rotation, and scale of the given sprite.
Note: All values (deltaLocation, deltaRotation, deltaScale) are
relative by default. It is possible to override the update
methods to change that and some TransformerAdapter do ((@see
WrapTransformerNG} for example).
| Constructor Summary | |
|---|---|
TransformerAdapter()
Construct a new TransformerAdapter with identity settings. |
|
TransformerAdapter(Location2D deltaLocation,
double deltaRotation,
double deltaScale)
Construct a new TransformerAdapter with the given values for the
instantaneous delta values. |
|
| Method Summary | |
|---|---|
void |
advance(double dT)
Advance the internal values of this TransformerAdapter by the
given time step. |
Location2D |
getLocation()
Get the amount of location this TransformerAdapter is applying
at the current time (instantaneous velocity). |
double |
getRotation()
Get the amount of rotation this TransformerAdapter is applying
at the current time (instantaneous angular velocity) |
double |
getRotationDegrees()
Get the amount of rotation this TransformerAdapter is applying
at the current time (instantaneous angular velocity) |
double |
getRotationRadians()
Get the amount of rotation this TransformerAdapter is applying
at the current time (instantaneous angular velocity) |
double |
getRotationRevolutions()
Get the amount of rotation this TransformerAdapter is applying
at the current time (instantaneous angular velocity) |
double |
getScale()
Get the percentage scale change this TransformerAdapter is
applying at the current time |
void |
nonMaskableAdvance(double dT)
Called before advance on each frame. |
void |
setLocation(Location2D location)
Set the delta location (instantaneous velocity) of the TransformerAdapter |
void |
setLocation(Vector2D location)
Set the delta location (instantaneous velocity) of the TransformerAdapter |
void |
setRotation(double radians)
Set the delta rotation (instantaneous angular velocity) of this TransformerAdapter |
void |
setRotationDegrees(double degrees)
Set the delta rotation (instantaneous angular velocity) of this TransformerAdapter |
void |
setRotationRadians(double radians)
Set the delta rotation (instantaneous angular velocity) of this TransformerAdapter |
void |
setRotationRevolutions(double revolutions)
Set the delta rotation (instantaneous angular velocity) of this TransformerAdapter |
void |
updateSprite(Sprite sprite)
Apply the delta values to the associated values in the Sprite; this is a helper method which should be called during
advance to make sure the Sprite reflects the values
intended by the TransformerAdapter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TransformerAdapter()
TransformerAdapter with identity settings.
public TransformerAdapter(Location2D deltaLocation,
double deltaRotation,
double deltaScale)
TransformerAdapter with the given values for the
instantaneous delta values.
deltaLocation - change in location in screens/seconddeltaRotation - change in rotation in radians/seconddeltaScale - change in scale in %/second (1.00 is
identity).| Method Detail |
|---|
public void advance(double dT)
TransformerAdapter by the
given time step. The result should be that the various attributes
of this transformer are set to the delta value for the current time
step.
advance in interface TransformerdT - elapsed time since the last call to advancepublic Location2D getLocation()
TransformerAdapter is applying
at the current time (instantaneous velocity).
public double getRotation()
TransformerAdapter is applying
at the current time (instantaneous angular velocity)
public final double getRotationDegrees()
TransformerAdapter is applying
at the current time (instantaneous angular velocity)
public final double getRotationRadians()
TransformerAdapter is applying
at the current time (instantaneous angular velocity)
public final double getRotationRevolutions()
TransformerAdapter is applying
at the current time (instantaneous angular velocity)
public double getScale()
TransformerAdapter is
applying at the current time
public void nonMaskableAdvance(double dT)
TransformerAdapter are required to call this on any wrapped
transformers every frame.
nonMaskableAdvance in interface TransformerdT - time since last advance in seconds.public void setLocation(Location2D location)
TransformerAdapter
location - the value to setpublic void setLocation(Vector2D location)
TransformerAdapter
location - the value to setpublic void setRotation(double radians)
TransformerAdapter
radians - rotation in radianspublic final void setRotationDegrees(double degrees)
TransformerAdapter
degrees - rotation in degreespublic final void setRotationRadians(double radians)
TransformerAdapter
radians - rotation in radianspublic final void setRotationRevolutions(double revolutions)
TransformerAdapter
revolutions - rotation in revolutionspublic void updateSprite(Sprite sprite)
Sprite; this is a helper method which should be called during
advance to make sure the Sprite reflects the values
intended by the TransformerAdapter.
updateSprite in interface Transformersprite - the sprite to update: updated in place!
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||