HUD drawing help (Draw."help")

Ok so i am still very new to lua and I’m trying to make a HUD because my Request seems to of fallen flat on its face in the mud.

I am looking for a list of things i can draw on the Hud so far i know of Two.

draw.RoundedBox
draw.SimpleText

How do i draw other shapes i have searched for the last hour and can not find the info any where.

also i need to know about positioning on the screen. Like where is 0,0 and where is the Max,Max

I understand it has a width and height just not sure on the number scale i am working with. (like in gpu i know the default units is 512x512 and that 0,0 is the top left and 512,512 is the bottom right) How is that in lua?

0,0 is the top left and the Max,Max is the bottom right. Your working in the screen resolution so if you have it to 1024x768 then you have 1024 pixels to work with in the width and 768 for the hieght. To get the max width/height it’s ScrW() and ScrH(). For more complex shapes look at this http://wiki.garrysmod.com/?title=Surface

0,0 is the top left
ScrW(),ScrH() is the bottom right.

ok thanks for the links i had searched most of them before but still cant work out how to draw a small circle.

On top of that i cant even get a small bit of lua that i have made to run.

also just to see if my under standing is correct.

Say i wanted to put a small box in the center of the screen at the top.

for the Hight i could do say 0 and the width could be ScrW()/2 - half the size of the box?

is that right or would that get screwed up

i may edit back here soon with my code i cant get to run console keeps telling me the file is missing and that’s total bull

Note that you’ll have to do all of your HUD drawing inside of **[Gamemode.HUDPaint

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.HUDPaint)**.

hmm maybe that is my problem here is my crappy code that ain’t working.

[lua]
surface.CreateFont(“Arial”,16,800,false,false,“Text1”)

function DrawHud()
local client = LocalPlayer()
if !client:Alive() then return end
if(client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == “Camera”) then return end
draw.RoundedBox( 10, 0, 0, 100, 150, Color(90,90,90, 255) );
draw.RoundedBox( 10, 3, 3, 97, 147, Color(190,190,190, 255) );
draw.SimpleText(“Score”,“Text1”,10,10,Color(0,0,0,255))
end

hook.Add("HUDPaint", "DrawHud", DrawHud);

function hidehud(name)
for k, v in pairs{"CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"} do
	if name == v then return false end
end

end
hook.Add(“HUDShouldDraw”, “hidehud”, hidehud)

concommand.Add(“BTTG_HUD”, DrawHud)
[/lua]

Your indentation was confusing but otherwise this works well :
[lua]surface.CreateFont(“Arial”,16,800,false,false,“Text1”)

function DrawHud()
local client = LocalPlayer()
if !client:Alive() then return end
if(client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == “Camera”) then return end
draw.RoundedBox( 10, 0, 0, 100, 150, Color(90,90,90, 255) );
draw.RoundedBox( 10, 3, 3, 97, 147, Color(190,190,190, 255) );
draw.SimpleText(“Score”,“Text1”,10,10,Color(0,0,0,255))
end

hook.Add(“HUDPaint”, “DrawHud”, DrawHud);

function hidehud(name)
for k, v in pairs{“CHudBattery”, “CHudAmmo”, “CHudSecondaryAmmo”} do
if name == v then return false end
end
end

hook.Add(“HUDShouldDraw”, “hidehud”, hidehud)
[/lua]
Make sure it’s executed clientside, and not serverside.

Thank you its all working now its just a matter of adjusting numbers is there any way i can reload the lua file with out restarting the server

my lua file is named test