Screen Positions

Ok i’m pretty novice at coding with derma so iv got a lot of things down but what i can never get the screen positions.

I was wondering if someone could help me draw a box at the top of the screen.

Basically the box would be a gray with a slight transparency.

hook.Add(“HUDPaint”, “DrawBoxes”, function()
draw.RoundedBox(0, 0, 10, ScrW(), 10, Color(50,50,50,150))
Should give you an idea of how it’s done

Thanks. Im guessing it’s a lot of trial and error when your
Doing it?

Nope it’s just simple calculations here i’ll explain it.

You wanted it to be on the top of your screen and a banner like bar accross was what I assumed.

I like the draw library so i’ll use the draw.RoundedBox(border,x,y,w,h,Color(r,g,b))

draw.RoundedBox(0, 0, 10, ScrW(), 10, Color(50,50,50,150))
The Border would be 0 so we dont see those nasty round edges.
The X coord would be 0 because we are starting from the top left of our screen.
The Y coord would depend on the height of the box.
Ex: If we had it set to 0 the box wouldn’t show because everything is being draw from the bottom up, if that makes sense.
Width is the screen width and I used ScrW() which is a function that takes the value of your screen width.
Ex: 1600x900 is what I use. ScrW() would be equal to 1600 because that’s the width of my screen.
**Height **is 10.
**Color **is self explanitory Color(red,green,blue,transparency A.K.A alpha).