Jump to content

Recommended Posts

Posted

I was wondering if anyone could help me with a glitch I am experiencing with the gui. So I wanted to load a background image on the main menu.The problem is that it loads buggy then you click and it loads perfectly. The code I used looked like this;

--GUI
    local gui = GUI:Create(context)
    gui:Hide()
    gui:SetScale(scale)
    local widget
    
    gui:GetBase():SetScript("Scripts/GUI/Panel.lua")
    gui:GetBase():SetObject("backgroundcolor",Vec4(0,0,0,1))
    --This part is my code
    local image = gui:LoadImage("Frame/Walkabout.tex")
    local imagePanel = Widget:Panel(0,0,1920,1080, gui:GetBase())
    imagePanel:SetImage(image)
    --Ends here

    GameMenu.gui=gui
    GameMenu.context = context

How do I get this to load properly the first time without having to click?

Error 1.jpg

Error2.jpg

Posted

most widgets by default only redraw when interacted with, in your example a simple click on the panel redraws it.

solution: 
  add a call to imagePanel:Redraw() when you are finished creating your widgets or right after SetImage().

  • 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...