Skip to content

UIResourceTexture ​

Since 2.2.1

UIResourceTexture is a reference to a texture asset saved in the LDLib2 editor resource system. It resolves the actual IGuiTexture lazily from the TexturesResource registry at draw time, making it suitable for editor-managed, data-driven textures.

Registry name: ui_resource_texture

INFO

Extends TransformTexture — supports rotate(), scale(), transform().

TIP

This texture type is primarily used by the in-game editor. For code-driven textures, prefer one of the other concrete types.


Usage ​

java
// Reference a texture saved under the built-in path "MY_BG"
IGuiTexture ref = new UIResourceTexture(new BuiltinPath("MY_BG"));

// Reference a file-based resource
IGuiTexture file = new UIResourceTexture(IResourcePath.parse("file:mymod:ui/panel"));

LSS ​

css
/* Built-in resource */
background: builtin(MY_BG);

/* File-based resource */
background: file("mymod:ui/panel");

Fields ​

NameTypeDescription
resourcePathIResourcePathThe path used to look up the texture in TexturesResource.

Methods ​

MethodReturnsDescription
getRawTexture()IGuiTextureReturns the raw underlying texture (resolving through internalTexture).
setColor(int)IGuiTextureCopies and tints the resolved internal texture.
copy()UIResourceTextureReturns this (the reference is immutable).

Released under the MIT License.