Derma Menu for all resolutions

Can anybody give me some advices on how to make a derma menu compatible with all resolutions?

You can use ScrW() and ScrH() to get the screen’s width and height.
You could do

menu:SetSize((ScrW() * 0.8),(ScrH() * 0.8))

which would set the derma panel’s size to 80% of the screen.

Thanks, but what’s with text inside the derma?


Use ScreenScale(n) when setting the size of a font. (Returns a font size that would be pretty much the same on all resolutions)

You can also scale text according to the resolution, with ScreenScale. You need to make a font for that, like this:

    surface.CreateFont("myFont", {
        font = "Roboto-Light",
        size = ScreenScale(14),
        weight = 250

my favorite way to do this is to remake the screenscale function (replace 1920x1080 with your res)

[lua]local scale = function(num, isY)
return num * (isY and (ScrH() / 1080) or (ScrW() / 1920))

that way I can design stuff for my screen without having to do trial-and-error with ScreenScale

Thanks for all the advices, I will give it a try tomorrow! :slight_smile:

Thiswould work for you if you change myscrw and myscrh to be your ScrW() and ScrH().