public class Sprite
extends com.badlogic.gdx.graphics.g2d.Sprite
Sprite
to auto-flip
Texture
s due to mini2Dx placing its origin in the top-left
corner rather than the bottom-left corner like LibGDXConstructor and Description |
---|
Sprite()
Creates an uninitialized sprite.
|
Sprite(Sprite sprite)
Creates a sprite that is a copy in every way of the specified sprite.
|
Sprite(com.badlogic.gdx.graphics.Texture texture)
Creates a sprite with width, height, and texture region equal to the size
of the texture.
|
Sprite(com.badlogic.gdx.graphics.Texture texture,
int srcWidth,
int srcHeight)
Creates a sprite with width, height, and texture region equal to the
specified size.
|
Sprite(com.badlogic.gdx.graphics.Texture texture,
int srcX,
int srcY,
int srcWidth,
int srcHeight)
Creates a sprite with width, height, and texture region equal to the
specified size.
|
Sprite(TextureRegion region)
Creates a sprite based on a specific TextureRegion, the new sprite's
region is a copy of the parameter region - altering one does not affect
the other
|
Sprite(TextureRegion region,
int srcX,
int srcY,
int srcWidth,
int srcHeight)
Creates a sprite with width, height, and texture region equal to the
specified size, relative to specified sprite's texture region.
|
Modifier and Type | Method and Description |
---|---|
float |
getAlpha()
Returns the current alpha value of this Sprite
|
int |
getRegionY() |
boolean |
isFlipY() |
void |
setFlip(boolean x,
boolean y) |
void |
setFlipX(boolean flipX)
Sets if the
Sprite is flipped horizontally |
void |
setFlipY(boolean flipY)
Sets if the
Sprite is flipped vertically |
draw, draw, flip, getBoundingRectangle, getColor, getHeight, getOriginX, getOriginY, getRotation, getScaleX, getScaleY, getVertices, getWidth, getX, getY, rotate, rotate90, scale, scroll, set, setAlpha, setBounds, setCenter, setCenterX, setCenterY, setColor, setColor, setColor, setOrigin, setOriginBasedPosition, setOriginCenter, setPosition, setRegion, setRotation, setScale, setScale, setSize, setU, setU2, setV, setV2, setX, setY, translate, translateX, translateY
public Sprite()
public Sprite(com.badlogic.gdx.graphics.Texture texture)
public Sprite(com.badlogic.gdx.graphics.Texture texture, int srcWidth, int srcHeight)
srcWidth
- The width of the texture region. May be negative to flip the
sprite when drawn.srcHeight
- The height of the texture region. May be negative to flip the
sprite when drawn.public Sprite(com.badlogic.gdx.graphics.Texture texture, int srcX, int srcY, int srcWidth, int srcHeight)
srcX
- The x coordinate of the region to drawsrcY
- The y coordinate of the region to drawsrcWidth
- The width of the texture region. May be negative to flip the
sprite when drawn.srcHeight
- The height of the texture region. May be negative to flip the
sprite when drawn.public Sprite(TextureRegion region)
public Sprite(TextureRegion region, int srcX, int srcY, int srcWidth, int srcHeight)
srcX
- The x coordinate of the region to drawsrcY
- The y coordinate of the region to drawsrcWidth
- The width of the texture region. May be negative to flip the
sprite when drawn.srcHeight
- The height of the texture region. May be negative to flip the
sprite when drawn.public Sprite(Sprite sprite)
public float getAlpha()
public boolean isFlipY()
isFlipY
in class com.badlogic.gdx.graphics.g2d.TextureRegion
public int getRegionY()
getRegionY
in class com.badlogic.gdx.graphics.g2d.TextureRegion
public void setFlip(boolean x, boolean y)
setFlip
in class com.badlogic.gdx.graphics.g2d.Sprite
public void setFlipX(boolean flipX)
Sprite
is flipped horizontallyflipX
- True if the region is flipped horizontallypublic void setFlipY(boolean flipY)
Sprite
is flipped verticallyflipY
- True if the region is flipped vertically