Java com.badlogic.gdx.graphics.g2d Sprite fields, constructors, methods, implement or subclass

Example usage for Java com.badlogic.gdx.graphics.g2d Sprite fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for com.badlogic.gdx.graphics.g2d Sprite.

The text is from its open source code.

Subclass

com.badlogic.gdx.graphics.g2d.Sprite has subclasses.
Click this link to see all its subclasses.

Constructor

Sprite(Texture texture)
Creates a sprite with width, height, and texture region equal to the size of the texture.
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(Sprite sprite)
Creates a sprite that is a copy in every way of the specified sprite.
Sprite(Texture texture, int srcWidth, int srcHeight)
Creates a sprite with width, height, and texture region equal to the specified size.
Sprite(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, 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.
Sprite()
Creates an uninitialized sprite.

Method

voiddraw(Batch batch)
voiddraw(Batch batch, float alphaModulation)
voidflip(boolean x, boolean y)
boolean parameters x,y are not setting a state, but performing a flip
RectanglegetBoundingRectangle()
Returns the bounding axis aligned Rectangle that bounds this sprite.
ColorgetColor()
Returns the color of this sprite.
floatgetHeight()
floatgetOriginX()
The origin influences #setPosition(float,float) , #setRotation(float) and the expansion direction of scaling #setScale(float,float)
floatgetOriginY()
The origin influences #setPosition(float,float) , #setRotation(float) and the expansion direction of scaling #setScale(float,float)
floatgetRotation()
floatgetScaleX()
X scale of the sprite, independent of size set by #setSize(float,float)
floatgetScaleY()
Y scale of the sprite, independent of size set by #setSize(float,float)
float[]getVertices()
Returns the packed vertices, colors, and texture coordinates for this sprite.
floatgetWidth()
floatgetX()
floatgetY()
voidrotate(float degrees)
Sets the sprite's rotation in degrees relative to the current rotation.
voidrotate90(boolean clockwise)
Rotates this sprite 90 degrees in-place by rotating the texture coordinates.
voidscale(float amount)
Sets the sprite's scale relative to the current scale.
voidsetAlpha(float a)
Sets the alpha portion of the color used to tint this sprite.
voidsetBounds(float x, float y, float width, float height)
Sets the position and size of the sprite when drawn, before scaling and rotation are applied.
voidsetCenter(float x, float y)
Sets the position so that the sprite is centered on (x, y)
voidsetColor(float r, float g, float b, float a)
voidsetColor(Color tint)
Sets the color used to tint this sprite.
voidsetColor(float color)
voidsetFlip(boolean x, boolean y)
Set the sprite's flip state regardless of current condition
voidsetOrigin(float originX, float originY)
Sets the origin in relation to the sprite's position for scaling and rotation.
voidsetOriginCenter()
Place origin in the center of the sprite
voidsetPosition(float x, float y)
Sets the position where the sprite will be drawn.
voidsetRegion(float u, float v, float u2, float v2)
voidsetRotation(float degrees)
Sets the rotation of the sprite in degrees.
voidsetScale(float scaleXY)
Sets the sprite's scale for both X and Y uniformly.
voidsetScale(float scaleX, float scaleY)
Sets the sprite's scale for both X and Y.
voidsetSize(float width, float height)
Sets the size of the sprite when drawn, before scaling and rotation are applied.
voidsetX(float x)
Sets the x position where the sprite will be drawn.
voidsetY(float y)
Sets the y position where the sprite will be drawn.
voidtranslate(float xAmount, float yAmount)
Sets the position relative to the current position where the sprite will be drawn.
voidtranslateX(float xAmount)
Sets the x position relative to the current position where the sprite will be drawn.
voidtranslateY(float yAmount)
Sets the y position relative to the current position where the sprite will be drawn.