In 1280 X 720 = ok
In 1920 X 1080 = no
Why?
https://files.facepunch.com/forum/upload/114477/7756b88d-a3f4-4597-adcd-53a76e58874f/20180105030028_1.jpg
This is right menu.
draw.RoundedBox(0, 1697, ScrH () - 73, 146, 67, Color(40, 40, 40, 255))
draw.RoundedBox(0, 1700, ScrH () - 70, 140, 60, Color(60, 60, 60, 255))
draw.RoundedBox(0, 1700, ScrH () - 40, 140, 2, Color(40, 40, 40, 255))
This is avatar
local function DrawPlayerAvatar( p ) --avatar
av = vgui.Create("AvatarImage")
av:SetPos(27,ScrH() - 120)
av:SetSize(58, 58)
av:SetPlayer( p, 64 )
end
if av then
return
else
DrawPlayerAvatar( LocalPlayer() ) --show avatar
end
The pos of the avatar is only set once (with setpos) whereas the rounded boxes are in a drawhook. Disconnect and rejoin, then your avatar will reposition itself in the right place.
I don't know how you would go about detecting a resolution change without checking it on every frame.
This is where Panel docking comes in to save your life. Have a read. Don't forget to set a margin with DockMargin so the avatar is aligned with your HUD.
You are using ScrH for the y axis, which is correct, but you should also be using ScrW for the x axis.
You need to subtract the width of your menu from ScrW(), and then subtract a little more from that number to create a margin on the right side. The result of this calculation will be the top left corner of your menu on the x axis. Replace the second arguments in your draw.RoundedBox calls with that number (or relative to that number).
Sorry, you need to Log In to post a reply to this thread.