Interface ContextualTextureRenderer<T,​C>

Type Parameters:
T - the texture type that this renderer can draw
C - the type of context that is needed to draw a texture
All Known Subinterfaces:
TextureRenderer<T>
All Known Implementing Classes:
AwtTextureRenderer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ContextualTextureRenderer<T,​C>
Texture renderers are used for drawing platform-specific textures and texture regions.
Since:
1.1.0
See Also:
texture renderers that don't need a context object
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    draw​(TextureRegion<? extends T> region, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)
    Draws rectangular subregion of a texture region.
    void
    draw​(T texture, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)
    Draws rectangular region of a texture.
    default void
    drawTiled​(TextureRegion<? extends T> region, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)
    Draws a tiled rectangular subregion of a texture.
    default void
    drawTiled​(T texture, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)
    Draws a tiled rectangular subregion of a texture.
  • Method Details

    • draw

      void draw​(T texture, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)
      Draws rectangular region of a texture.
      Parameters:
      texture - the texture
      context - the context needed to draw the texture
      x - the leftmost X coordinate of the target drawing region
      y - the topmost Y coordinate of the target drawing region
      width - the width of the target region
      height - the height of the target region
      u1 - the left edge of the input region as a fraction from 0 to 1
      v1 - the top edge of the input region as a fraction from 0 to 1
      u2 - the right edge of the input region as a fraction from 0 to 1
      v2 - the bottom edge of the input region as a fraction from 0 to 1
    • draw

      default void draw​(TextureRegion<? extends T> region, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)
      Draws rectangular subregion of a texture region.
      Parameters:
      region - the texture region
      context - the context needed to draw the texture
      x - the leftmost X coordinate of the target drawing region
      y - the topmost Y coordinate of the target drawing region
      width - the width of the target region
      height - the height of the target region
      u1 - the left edge of the input region as a fraction from 0 to 1
      v1 - the top edge of the input region as a fraction from 0 to 1
      u2 - the right edge of the input region as a fraction from 0 to 1
      v2 - the bottom edge of the input region as a fraction from 0 to 1
    • drawTiled

      default void drawTiled​(T texture, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)
      Draws a tiled rectangular subregion of a texture.

      The default implementation uses draw() to draw each tile, but implementations may want to override this method for more performant rendering.

      Parameters:
      texture - the texture
      context - the context needed to draw the texture
      x - the leftmost X coordinate of the target drawing region
      y - the topmost Y coordinate of the target drawing region
      regionWidth - the total width of the target region
      regionHeight - the total height of the target region
      tileWidth - the width of an individual tile in the target region
      tileHeight - the height of an individual tile in the target region
      u1 - the left edge of the input region as a fraction from 0 to 1
      v1 - the top edge of the input region as a fraction from 0 to 1
      u2 - the right edge of the input region as a fraction from 0 to 1
      v2 - the bottom edge of the input region as a fraction from 0 to 1
      Since:
      1.2.0
    • drawTiled

      default void drawTiled​(TextureRegion<? extends T> region, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)
      Draws a tiled rectangular subregion of a texture.

      The default implementation delegates to the overload taking a raw {@code T} texture; generally only that overload should be overridden.

      Parameters:
      region - the texture region
      context - the context needed to draw the texture
      x - the leftmost X coordinate of the target drawing region
      y - the topmost Y coordinate of the target drawing region
      regionWidth - the total width of the target region
      regionHeight - the total height of the target region
      tileWidth - the width of an individual tile in the target region
      tileHeight - the height of an individual tile in the target region
      u1 - the left edge of the input region as a fraction from 0 to 1
      v1 - the top edge of the input region as a fraction from 0 to 1
      u2 - the right edge of the input region as a fraction from 0 to 1
      v2 - the bottom edge of the input region as a fraction from 0 to 1
      Since:
      1.2.0