Archive 17/01/2023.

[SOLVED]loading an image to a BorderImage

rogerdv

I want to load an specific image inside a BorderImage element, through this code:

UIElement@ grid = invWin.GetChild("grid", true); BorderImage@ itemPort = BorderImage(); itemPort.SetSize(32, 32); itemPort.texture = Texture(); itemPort.texture.Load(cache.GetFile("Textures/portraits/2h-axe.png")); itemPort.imageRect = IntRect(0, 0, 128, 128); grid.AddChild(itemPort);

But I just get a white square. Whats wrong in my code?

cadaver

Texture is the base class that doesn’t actually know how to allocate a GPU texture. Instantiate a Texture2D instead.