Jump to content

Change Size Font Widget GUI? ( Lua )


Go to solution Solved by Dreikblack,

Recommended Posts

Posted
On 3/23/2025 at 7:52 PM, Dreikblack said:
local font = LoadFont("Fonts/YourFont.ttf");
ui = CreateInterface(camera, font, framebufferSize)

You can choose font only for whole interface when creating it.

 

Widget Image?

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Posted

I'm just trying to understand how this works in widgets, what should I keep in mind when working with images in widgets?

image.thumb.png.8e13c39fcc8ca81a1ce52ee46ee30d2e.png

    -- Método para agregar un msgbox.
    function this:CreateMsgBox(id, text, x, y, width, height, buttons)
        local panel = self.gui:AddPanel(id, x, y, width, height)
 
        local title  = "INFO"
        self.labelInfo = self.gui:AddLabel(id, title, 0, 0, width, height - 120, panel, LABEL_CENTER + LABEL_MIDDLE)
        self.labelInfo:SetFontScale(2.5)
 
        self.label = self.gui:AddLabel(id, text, 0, 10, width, height - 30, panel, LABEL_CENTER + LABEL_MIDDLE)
        self.label:SetFontScale(2)
       -- self.widgets[id .. "_label"] = label
       
   -- test
       local pixmap = LoadPixmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/dirt01.dds")
       
     
       -- Crear botones
        local buttonX = 40
        for btnId, btnText in pairs(buttons) do
            local button = self.gui:AddButton(btnId, btnText, buttonX, height - 60, 180, 40, panel)
            buttonX = buttonX + 240
       
            button:SetFontScale(1.5)
            button:SetPixmap(pixmap)
            --self.widgets[id .. "_button_" .. btnId] = button
        end
 
       return panel
    end

 

 

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Posted
31 minutes ago, Yue said:

I'm just trying to understand how this works in widgets, what should I keep in mind when working with images in widgets?

2nd var in Widget:SetPixmap can be used place it at center or stretch over the widget.

Button widget will put image at left to text anyway. If you remove text then image will be work normally.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...