Skip to content

Texture

@Composable



fun Texture(
    loc: ResourceLocation, 
    uOffset: Float, 
    vOffset: Float, 
    u: Int, 
    v: Int, 
    textureWidth: Int, 
    textureHeight: Int, 
    modifier: Modifier = Modifier
)

Renders a sprite region from a texture atlas using UV coordinates.

The composable sizes itself to the minimum constraints provided by its parent and blits the specified region from the texture at loc scaled to fill the node's bounds.

Example

Texture(
    loc = Archie["textures/gui/widgets.png"],
    uOffset = 0f, vOffset = 0f,
    u = 16, v = 16,
    textureWidth = 256, textureHeight = 256,
    modifier = Modifier.size(16, 16),
)

Parameters

  • loc: Resource location of the texture file.

  • uOffset: Horizontal UV start offset within the texture (in texture pixels).

  • vOffset: Vertical UV start offset within the texture (in texture pixels).

  • u: Width of the source region in texture pixels.

  • v: Height of the source region in texture pixels.

  • textureWidth: Total width of the texture atlas in pixels.

  • textureHeight: Total height of the texture atlas in pixels.

  • modifier: Additional modifiers applied to the layout node.