public class PolygonSprite extends Object
Constructor and Description |
---|
PolygonSprite(PolygonRegion region) |
PolygonSprite(PolygonSprite sprite)
Creates a sprite that is a copy in every way of the specified sprite.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(PolygonSpriteBatch spriteBatch) |
void |
draw(PolygonSpriteBatch spriteBatch,
float alphaModulation) |
Rectangle |
getBoundingRectangle()
Returns the bounding axis aligned
Rectangle that bounds this sprite. |
Color |
getColor()
Returns the color of this sprite.
|
float |
getHeight() |
float |
getOriginX() |
float |
getOriginY() |
Color |
getPackedColor()
Returns the actual color used in the vertices of this sprite.
|
PolygonRegion |
getRegion() |
float |
getRotation() |
float |
getScaleX() |
float |
getScaleY() |
float[] |
getVertices()
Returns the packed vertices, colors, and texture coordinates for this sprite.
|
float |
getWidth() |
float |
getX() |
float |
getY() |
void |
rotate(float degrees)
Sets the sprite's rotation relative to the current rotation.
|
void |
scale(float amount)
Sets the sprite's scale relative to the current scale.
|
void |
set(PolygonSprite sprite) |
void |
setBounds(float x,
float y,
float width,
float height)
Sets the position and size of the sprite when drawn, before scaling and rotation are applied.
|
void |
setColor(Color tint) |
void |
setColor(float r,
float g,
float b,
float a) |
void |
setOrigin(float originX,
float originY)
Sets the origin in relation to the sprite's position for scaling and rotation.
|
void |
setPosition(float x,
float y)
Sets the position where the sprite will be drawn.
|
void |
setRegion(PolygonRegion region) |
void |
setRotation(float degrees) |
void |
setScale(float scaleXY) |
void |
setScale(float scaleX,
float scaleY) |
void |
setSize(float width,
float height)
Sets the size of the sprite when drawn, before scaling and rotation are applied.
|
void |
setX(float x)
Sets the x position where the sprite will be drawn.
|
void |
setY(float y)
Sets the y position where the sprite will be drawn.
|
void |
translate(float xAmount,
float yAmount)
Sets the position relative to the current position where the sprite will be drawn.
|
void |
translateX(float xAmount)
Sets the x position relative to the current position where the sprite will be drawn.
|
void |
translateY(float yAmount)
Sets the y position relative to the current position where the sprite will be drawn.
|
public PolygonSprite(PolygonRegion region)
public PolygonSprite(PolygonSprite sprite)
public void set(PolygonSprite sprite)
public void setBounds(float x, float y, float width, float height)
public void setSize(float width, float height)
setBounds(float, float, float, float)
.public void setPosition(float x, float y)
setBounds(float, float, float, float)
.public void setX(float x)
setBounds(float, float, float, float)
.public void setY(float y)
setBounds(float, float, float, float)
.public void translateX(float xAmount)
public void translateY(float yAmount)
public void translate(float xAmount, float yAmount)
public void setColor(Color tint)
public void setColor(float r, float g, float b, float a)
public void setOrigin(float originX, float originY)
public void setRotation(float degrees)
public void rotate(float degrees)
public void setScale(float scaleXY)
public void setScale(float scaleX, float scaleY)
public void scale(float amount)
public float[] getVertices()
public Rectangle getBoundingRectangle()
Rectangle
that bounds this sprite. The rectangles x and y coordinates describe its
bottom left corner. If you change the position or size of the sprite, you have to fetch the triangle again for it to be
recomputed.public void draw(PolygonSpriteBatch spriteBatch)
public void draw(PolygonSpriteBatch spriteBatch, float alphaModulation)
public float getX()
public float getY()
public float getWidth()
public float getHeight()
public float getOriginX()
public float getOriginY()
public float getRotation()
public float getScaleX()
public float getScaleY()
public Color getColor()
setColor(Color)
or setColor(float, float, float, float)
is subsequently called before drawing this sprite.public Color getPackedColor()
setColor(Color)
or setColor(float, float, float, float)
is subsequently called before drawing this
sprite.public void setRegion(PolygonRegion region)
public PolygonRegion getRegion()
Copyright © 2021. All rights reserved.