Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This code is pretty ugly but hopefully it will be useful to you.
- local width, height = ScrW(), ScrH()
- local aspect = 9/16
- local showoutline = true
- local function ScrW()
- return width
- end
- local function ScrH()
- return height
- end
- local window, slider = vgui.Create("DFrame")
- window:SetSize(200, 150)
- window:Center()
- window:MakePopup()
- window:SetScreenLock(true)
- window:SetTitle("Nicolas")
- function window:OnClose()
- hook.Remove("HUDPaint", "nicolas")
- end
- local combo, aspectcombo = vgui.Create("DComboBox", window)
- combo:DockMargin(0, 4, 0, 0)
- combo:Dock(BOTTOM)
- combo:AddChoice("640 x 480 (4:3)", {640, 480, 1})
- combo:AddChoice("1280 x 1024 (5:4)", {640, 480, 2})
- combo:AddChoice("1280 x 720 (16:9)", {1280, 720, 3})
- combo:AddChoice("1920 x 1080 (16:9)", {1920, 1080, 3})
- combo:AddChoice("1680 x 1050 (16:10)", {1920, 1080, 4})
- function combo:OnSelect(i, v, d)
- aspectcombo:ChooseOptionID(d[3])
- slider:SetValue(d[1])
- end
- aspectcombo = vgui.Create("DComboBox", window)
- aspectcombo:DockMargin(0, 4, 0, 0)
- aspectcombo:Dock(BOTTOM)
- aspectcombo:AddChoice("4:3", 3/4)
- aspectcombo:AddChoice("5:4", 4/5)
- aspectcombo:AddChoice("16:9", 9/16)
- aspectcombo:AddChoice("16:10", 10/16)
- function aspectcombo:OnSelect(i, v, d)
- aspect = tonumber(d)
- slider:OnValueChanged(width)
- end
- slider = vgui.Create("DNumSlider", window)
- slider:Dock(FILL)
- slider:SetMin(0)
- slider:SetMax(width)
- slider:SetDecimals(0)
- function slider:OnValueChanged(v)
- width = v
- height = aspect*v
- self:SetText(string.format("%u x %u", ScrW(), ScrH()))
- end
- aspectcombo:ChooseOptionID(3)
- combo:ChooseOptionID(3)
- local check = vgui.Create("DCheckBoxLabel", window)
- check:DockMargin(0, 4, 0, 0)
- check:Dock(BOTTOM)
- check:SetText("Show outline")
- check:SetChecked(showoutline)
- function check:OnChange(v)
- showoutline = v
- end
- -- Your code here
- hook.Add("HUDPaint", "nicolas", function()
- surface.SetDrawColor(31, 0, 0, 95)
- surface.DrawRect(0, 0, width, height)
- if showoutline then
- surface.SetDrawColor(0, 0, 0, 255)
- surface.DrawOutlinedRect(1, 1, width-2, height-2)
- surface.DrawOutlinedRect(-1, -1, width+2, height+2)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawOutlinedRect(0, 0, width, height)
- end
- -- Your code here
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement