Class WTiledSprite


public class WTiledSprite extends WSprite
A sprite whose texture will be tiled.
Since:
2.0.0
  • Constructor Details

    • WTiledSprite

      public WTiledSprite(int tileWidth, int tileHeight, Identifier image)
      Create a tiled sprite.
      Parameters:
      tileWidth - The width a tile
      tileHeight - The height of a tile
      image - The image to tile
    • WTiledSprite

      public WTiledSprite(int tileWidth, int tileHeight, int frameTime, Identifier... frames)
      Create a new animated tiled sprite.
      Parameters:
      tileWidth - The width a tile
      tileHeight - The height of a tile
      frameTime - How long in milliseconds to display for. (1 tick = 50 ms)
      frames - The locations of the frames of the animation.
    • WTiledSprite

      public WTiledSprite(int tileWidth, int tileHeight, Texture image)
      Create a tiled sprite.
      Parameters:
      tileWidth - The width a tile
      tileHeight - The height of a tile
      image - The image to tile
      Since:
      3.0.0
    • WTiledSprite

      public WTiledSprite(int tileWidth, int tileHeight, int frameTime, Texture... frames)
      Create a new animated tiled sprite.
      Parameters:
      tileWidth - The width a tile
      tileHeight - The height of a tile
      frameTime - How long in milliseconds to display for. (1 tick = 50 ms)
      frames - The locations of the frames of the animation.
      Since:
      3.0.0
  • Method Details

    • setTileSize

      public void setTileSize(int width, int height)
      Sets the tiling size. This determines how often the texture will repeat.
      Parameters:
      width - the new tiling width
      height - the new tiling height
    • getTileWidth

      public int getTileWidth()
      Gets the tile width of this sprite.
      Returns:
      the tile width
      Since:
      2.2.0
    • getTileHeight

      public int getTileHeight()
      Gets the tile height of this sprite.
      Returns:
      the tile height
      Since:
      2.2.0
    • setTileWidth

      public WTiledSprite setTileWidth(int tileWidth)
      Sets the tile width of this sprite.
      Parameters:
      tileWidth - the new tile width
      Returns:
      this sprite
      Since:
      2.2.0
    • setTileHeight

      public WTiledSprite setTileHeight(int tileHeight)
      Sets the tile height of this sprite.
      Parameters:
      tileHeight - the new tile height
      Returns:
      this sprite
      Since:
      2.2.0
    • paintFrame

      @Environment(CLIENT) public void paintFrame(DrawContext context, int x, int y, Texture texture)
      Description copied from class: WSprite
      Paints a single frame for this sprite.
      Overrides:
      paintFrame in class WSprite
      Parameters:
      context - the draw context
      x - the X coordinate to draw it at
      y - the Y coordinate to draw it at
      texture - the texture to draw