Class: Widget
Lua
C++
Edit

Widget:SetIcon

This method adds an icon to the widget.

Syntax

Parameter Description
icon icon to set
alignment pixmap alignment mode, may be PIXMAP_CENTER, PIXMAP_CONTAIN, PIXMAP_COVER, PIXMAP_STRETCH, or PIXMAP_FIT
scale icon scale

Example

local displays = GetDisplays()

-- Create a window
local window = CreateWindow("Ultra Engine", 0, 0, 800, 800, displays[1])

-- Create a user interface
local ui = CreateInterface(window)

-- Load an icon
local icon = LoadIcon("https://github.com/UltraEngine/Documentation/raw/master/Assets/Materials/Logos/23.svg")

-- Show the icon
ui.background:SetIcon(icon)

while true do
    local ev = WaitEvent()
    if ev.id == EVENT_WINDOWCLOSE then
        return 0
    end
end
Copyright © 2024 Ultra Software.
All rights reserved.