Artenus 2D Framework
Artenus Reference
Displays an image block on the screen. It provides tools for retrieving portions of a atlas texture and handling frames for animations.

See Also:

public class ImageSprite
extends SpriteEntity

Field Summary

Fields inherited from com.annahid.libs.artenus.graphics.sprites.SpriteEntity

Constructor Summary

Modifier and TypeConstructor and Description
public ImageSprite(int resourceId, ImageSprite.Cutout co)
Creates an ImageSprite with the given texture and Cutout.

Method Summary

Modifier and TypeMethod and Description
public intgetCurrentFrame()
Gets the current frame for this ImageSprite.
public TexturegetTexture()
Gets the texture associated with this ImageSprite.
public voidgotoFrame(int index)
Sets the current frame for this ImageSprite.
public voidrender(RenderingContext context, int flags)
Renders the visual content.

Methods inherited from com.annahid.libs.artenus.graphics.sprites.SpriteEntity

Methods inherited from java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ImageSprite
public  ImageSprite(
    int resourceId,
    ImageSprite.Cutout co
)
Creates an ImageSprite with the given texture and Cutout. When you create an ImageSprite, make sure that the corresponding texture exists and is loaded beforehand. See TextureManager for more details.
Parameters:
resourceIdThe resource identifier for the texture. This can be for an ordinary image (png, jpeg, etc.) or an SVG file.
coThe cutout instructor to generate frames
See Also:

Method Detail

getCurrentFrame
public int getCurrentFrame()
Gets the current frame for this ImageSprite. Frames are determined by the associated ImageSprite.Cutout.
Returns:
The current frame
getTexture
public Texture getTexture()
Gets the texture associated with this ImageSprite.
Returns:
The associated Texture
gotoFrame
public void gotoFrame(
    int index
)
Sets the current frame for this ImageSprite. Frames are determined by the associated ImageSprite.Cutout.
Parameters:
indexThe frame index to change to
render
public void render(
    RenderingContext context,
    int flags
)
Renders the visual content.