Example usage for Java com.badlogic.gdx.graphics.g2d Sprite fields, constructors, methods, implement or subclass
The text is from its open source code.
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. |
void | draw(Batch batch) |
void | draw(Batch batch, float alphaModulation) |
void | flip(boolean x, boolean y) boolean parameters x,y are not setting a state, but performing a flip |
Rectangle | getBoundingRectangle() Returns the bounding axis aligned Rectangle that bounds this sprite. |
Color | getColor() Returns the color of this sprite. |
float | getHeight() |
float | getOriginX() The origin influences #setPosition(float,float) , #setRotation(float) and the expansion direction of scaling #setScale(float,float) |
float | getOriginY() The origin influences #setPosition(float,float) , #setRotation(float) and the expansion direction of scaling #setScale(float,float) |
float | getRotation() |
float | getScaleX() X scale of the sprite, independent of size set by #setSize(float,float) |
float | getScaleY() 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. |
float | getWidth() |
float | getX() |
float | getY() |
void | rotate(float degrees) Sets the sprite's rotation in degrees relative to the current rotation. |
void | rotate90(boolean clockwise) Rotates this sprite 90 degrees in-place by rotating the texture coordinates. |
void | scale(float amount) Sets the sprite's scale relative to the current scale. |
void | setAlpha(float a) Sets the alpha portion of the color used to tint this 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 | setCenter(float x, float y) Sets the position so that the sprite is centered on (x, y) |
void | setColor(float r, float g, float b, float a) |
void | setColor(Color tint) Sets the color used to tint this sprite. |
void | setColor(float color) |
void | setFlip(boolean x, boolean y) Set the sprite's flip state regardless of current condition |
void | setOrigin(float originX, float originY) Sets the origin in relation to the sprite's position for scaling and rotation. |
void | setOriginCenter() Place origin in the center of the sprite |
void | setPosition(float x, float y) Sets the position where the sprite will be drawn. |
void | setRegion(float u, float v, float u2, float v2) |
void | setRotation(float degrees) Sets the rotation of the sprite in degrees. |
void | setScale(float scaleXY) Sets the sprite's scale for both X and Y uniformly. |
void | setScale(float scaleX, float scaleY) Sets the sprite's scale for both X and Y. |
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. |