Making Geometrical forms


I have been trying to make some forms to huds, and just to learn how I can make them and I been trying to make this forms:

Can someone tell me how I can make them ? ( I know I need to use DrawPoly but I really cant understand how to do it )

Question 2 : What is the size of a gmod screen ( X = ??? Y = ???/Height = ??? Width = ??? )

If I get the X and Y/Height and Width of the Gmod Screen I could try to make a template to know the X and Y and would be probably easier to make rectangles and other forms.

GMod renders from top left corner down to the lower right corner.

You can get the screen resolution by calling ScrW() to get width, and ScrH() to get height.

x = 0
y = 0
Width = ScrW()
Height = ScrH()

Here’s an example from the wiki, so I don’t understand what it is you don’t understand.

surface.DrawPoly takes a table of vertices, for example:

surface.DrawPoly( { -- Triangle covering the upper half diagonal side of the screen.

    { x = 0, y = 0 },
    { x = ScrW(), y = 0 },
    { x = 0, y = ScrH() }

} )

But How would I get the ScrW and the ScrH in numbers ??

ScrW() and ScrH() already return a number, the width, and height, respectively.

Here’s an image that should help you visualize the polygon.

I wanted to know the ScrW and ScrH in numbers so I could make something like this

So when I am making something that needs X and Y would be easier to find out

You may want to learn programming some programming basics firsts.

ScrW() is a function that returns the client’s screen resolution width.

Instead of using constants, use ScrW() and ScrH() respectively so that HUD positioning / dimensions are dynamic. If you want to know ScrW() and ScrH(), simply print them onto the conolse, but again. Don’t use “magic numbers”.