• Screen Positions
    3 replies, posted
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.
[lua] hook.Add("HUDPaint", "DrawBoxes", function() draw.RoundedBox(0, 0, 10, ScrW(), 10, Color(50,50,50,150)) end) [/lua] 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?
[QUOTE=LedZepp;37232321]Thanks. Im guessing it's a lot of trial and error when your Doing it?[/QUOTE] 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. Drawing: I like the draw library so i'll use the draw.RoundedBox(border,x,y,w,h,Color(r,g,b)) [B]draw.RoundedBox(0, 0, 10, ScrW(), 10, Color(50,50,50,150))[/B] The [B]Border[/B] would be 0 so we dont see those nasty round edges. The [B]X[/B] coord would be 0 because we are starting from the top left of our screen. The [B]Y[/B] coord would depend on the height of the box. [U]Ex:[/U] 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. [B]Width[/B] is the screen width and I used [B]ScrW()[/B] which is a function that takes the value of your screen width. [U]Ex:[/U] 1600x900 is what I use. ScrW() would be equal to 1600 because that's the width of my screen. [B]Height [/B]is 10. [B]Color [/B]is self explanitory Color(red,green,blue,transparency A.K.A alpha).
Sorry, you need to Log In to post a reply to this thread.