Class TextureAtlas.AtlasSprite
java.lang.Object
gaiasky.render.gdx.g2d.TextureRegion
gaiasky.render.gdx.g2d.Sprite
gaiasky.render.gdx.g2d.TextureAtlas.AtlasSprite
- Enclosing class:
TextureAtlas
A sprite that, if whitespace was stripped from the region when it was packed, is automatically positioned as if whitespace
had not been stripped.
-
Constructor Summary
ConstructorsConstructorDescriptionAtlasSprite(TextureAtlas.AtlasRegion region) AtlasSprite(TextureAtlas.AtlasSprite sprite) -
Method Summary
Modifier and TypeMethodDescriptionvoidflip(boolean x, boolean y) boolean parameters x,y are not setting a state, but performing a flipfloatfloatfloatThe origin influencesSprite.setPosition(float, float),Sprite.setRotation(float)and the expansion direction of scalingSprite.setScale(float, float)floatThe origin influencesSprite.setPosition(float, float),Sprite.setRotation(float)and the expansion direction of scalingSprite.setScale(float, float)floatgetWidth()floatfloatgetX()floatgetY()voidrotate90(boolean clockwise) Rotates this sprite 90 degrees in-place by rotating the texture coordinates.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.voidsetOrigin(float originX, float originY) Sets the origin in relation to the sprite's position for scaling and rotation.voidPlace origin in the center of the spritevoidsetPosition(float x, float y) Sets the position where the sprite will be drawn.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.toString()Methods inherited from class Sprite
draw, draw, getBoundingRectangle, getColor, getRotation, getScaleX, getScaleY, getVertices, rotate, scale, scroll, set, setAlpha, setCenter, setCenterX, setCenterY, setColor, setColor, setFlip, setOriginBasedPosition, setPackedColor, setRegion, setRotation, setScale, setScale, setU, setU2, setV, setV2, translate, translateX, translateYModifier and TypeMethodDescriptionvoiddraw(com.badlogic.gdx.graphics.g2d.Batch batch) voiddraw(com.badlogic.gdx.graphics.g2d.Batch batch, float alphaModulation) com.badlogic.gdx.math.RectangleReturns the bounding axis alignedRectanglethat bounds this sprite.com.badlogic.gdx.graphics.ColorgetColor()Returns the color of this sprite.floatfloatX scale of the sprite, independent of size set bySprite.setSize(float, float)floatY scale of the sprite, independent of size set bySprite.setSize(float, float)float[]Returns the packed vertices, colors, and texture coordinates for this sprite.voidrotate(float degrees) Sets the sprite's rotation in degrees relative to the current rotation.voidscale(float amount) Sets the sprite's scale relative to the current scale.voidscroll(float xAmount, float yAmount) Offsets the region relative to the current region.voidMake this sprite a copy in every way of the specified spritevoidsetAlpha(float a) Sets the alpha portion of the color used to tint this sprite.voidsetCenter(float x, float y) Sets the position so that the sprite is centered on (x, y)voidsetCenterX(float x) Sets the x position so that it is centered on the given x parametervoidsetCenterY(float y) Sets the y position so that it is centered on the given y parametervoidsetColor(float r, float g, float b, float a) voidsetColor(com.badlogic.gdx.graphics.Color tint) Sets the color used to tint this sprite.voidsetFlip(boolean x, boolean y) Set the sprite's flip state regardless of current conditionvoidsetOriginBasedPosition(float x, float y) Sets the position where the sprite will be drawn, relative to its current origin.voidsetPackedColor(float packedColor) Sets the color of this sprite, expanding the alpha from 0-254 to 0-255.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.voidsetU(float u) voidsetU2(float u2) voidsetV(float v) voidsetV2(float v2) 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.Methods inherited from class TextureRegion
getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, split, splitModifier and TypeMethodDescriptionintReturns the region's height.intReturns the region's width.intintcom.badlogic.gdx.graphics.TexturefloatgetU()floatgetU2()floatgetV()floatgetV2()booleanisFlipX()booleanisFlipY()voidsetRegion(int x, int y, int width, int height) voidsetRegion(com.badlogic.gdx.graphics.Texture texture) Sets the texture and sets the coordinates to the size of the specified texture.voidsetRegion(TextureRegion region) Sets the texture and coordinates to the specified region.voidsetRegion(TextureRegion region, int x, int y, int width, int height) Sets the texture to that of the specified region and sets the coordinates relative to the specified region.voidsetRegionHeight(int height) voidsetRegionWidth(int width) voidsetRegionX(int x) voidsetRegionY(int y) voidsetTexture(com.badlogic.gdx.graphics.Texture texture) TextureRegion[][]split(int tileWidth, int tileHeight) Helper function to create tiles out of this TextureRegion starting from the top left corner going to the right and ending at the bottom right corner.static TextureRegion[][]split(com.badlogic.gdx.graphics.Texture texture, int tileWidth, int tileHeight) Helper function to create tiles out of the givenTexturestarting from the top left corner going to the right and ending at the bottom right corner.
-
Constructor Details
-
AtlasSprite
-
AtlasSprite
-
-
Method Details
-
setPosition
public void setPosition(float x, float y) Description copied from class:SpriteSets the position where the sprite will be drawn. If origin, rotation, or scale are changed, it is slightly more efficient to set the position after those operations. If both position and size are to be changed, it is better to useSprite.setBounds(float, float, float, float).- Overrides:
setPositionin classSprite
-
setBounds
public void setBounds(float x, float y, float width, float height) Description copied from class:SpriteSets the position and size of the sprite when drawn, before scaling and rotation are applied. If origin, rotation, or scale are changed, it is slightly more efficient to set the bounds after those operations. -
setSize
public void setSize(float width, float height) Description copied from class:SpriteSets the size of the sprite when drawn, before scaling and rotation are applied. If origin, rotation, or scale are changed, it is slightly more efficient to set the size after those operations. If both position and size are to be changed, it is better to useSprite.setBounds(float, float, float, float). -
setOrigin
-
setOriginCenter
public void setOriginCenter()Description copied from class:SpritePlace origin in the center of the sprite- Overrides:
setOriginCenterin classSprite
-
flip
-
rotate90
public void rotate90(boolean clockwise) Description copied from class:SpriteRotates this sprite 90 degrees in-place by rotating the texture coordinates. This rotation is unaffected bySprite.setRotation(float)andSprite.rotate(float). -
getX
-
setX
public void setX(float x) Description copied from class:SpriteSets the x position where the sprite will be drawn. If origin, rotation, or scale are changed, it is slightly more efficient to set the position after those operations. If both position and size are to be changed, it is better to useSprite.setBounds(float, float, float, float). -
getY
-
setY
public void setY(float y) Description copied from class:SpriteSets the y position where the sprite will be drawn. If origin, rotation, or scale are changed, it is slightly more efficient to set the position after those operations. If both position and size are to be changed, it is better to useSprite.setBounds(float, float, float, float). -
getOriginX
public float getOriginX()Description copied from class:SpriteThe origin influencesSprite.setPosition(float, float),Sprite.setRotation(float)and the expansion direction of scalingSprite.setScale(float, float)- Overrides:
getOriginXin classSprite
-
getOriginY
public float getOriginY()Description copied from class:SpriteThe origin influencesSprite.setPosition(float, float),Sprite.setRotation(float)and the expansion direction of scalingSprite.setScale(float, float)- Overrides:
getOriginYin classSprite
-
getWidth
-
getHeight
-
getWidthRatio
public float getWidthRatio() -
getHeightRatio
public float getHeightRatio() -
getAtlasRegion
-
toString
-