public class AttachedImage extends Object
Constructor and Description |
---|
AttachedImage(Body body,
BodyImage image,
float scale,
float rotation,
Vec2 offset)
Create a new instance of an image.
|
Modifier and Type | Method and Description |
---|---|
void |
flipHorizontal()
Flip the orientation of this image instance horizontally (reflect in a
vertical axis passing through the origin).
|
void |
flipVertical()
Flip the orientation of this image instance vertically (reflect in a
horizontal axis passing through the origin).
|
BodyImage |
getBodyImage()
The
BodyImage of which this is an instance. |
Vec2 |
getOffset()
The offset for this image instance.
|
float |
getRotation()
The angle of rotation for this image instance.
|
float |
getScale()
The scale factor for this image instance.
|
boolean |
isFlippedHorizontal()
Is this image instance flipped horizontally relative to its original
state?
|
boolean |
isFlippedVertical()
Is this image instance flipped vertically relative to its original
state?
|
void |
reset()
Reset scale, rotation and offset to their original values.
|
void |
setOffset(Vec2 offset)
Set the offset for this image instance.
|
void |
setRotation(float rotation)
Set the angle of rotation for this image instance.
|
void |
setScale(float scale)
Set the scale factor for this image instance.
|
public AttachedImage(Body body, BodyImage image, float scale, float rotation, Vec2 offset)
body
- the body to which this instance will be attachedimage
- the imagescale
- the scale at which to draw this instance (1.0 is full size)rotation
- the angle (in radians) by which to rotate around the body's originoffset
- the offset from the body's origin at which to draw this instancepublic BodyImage getBodyImage()
BodyImage
of which this is an instance.public void reset()
public void flipHorizontal()
public void flipVertical()
public float getScale()
public void setScale(float scale)
scale
- the new scale factorpublic float getRotation()
public void setRotation(float rotation)
rotation
- the new angle (in radians)public Vec2 getOffset()
public void setOffset(Vec2 offset)
offset
- the new offsetpublic boolean isFlippedHorizontal()
public boolean isFlippedVertical()