[lua]draw.RoundedBox( 6, ScrW() * 0.255, ScrH() * 0.9075, hp, height2, Color( 255, 0, 0, 200 ) )[/lua]
[lua]local height2 = 11[/lua]( I know I need to scale this still. )
[QUOTE=Entoros;20693408]Generic centering thing:
[code]panel:SetSize( w, h )
panel:SetPos( parent:GetWide() / 2 - panel:GetWide() /2, parent:GetTall() / 2 - panel:GetTall() / 2 )[/code][/QUOTE]
A while back, I heard somebody say that instead of dividing by 2, multiplying by .5 was more efficient. Comments?
[editline]12:15AM[/editline]
[QUOTE=wakeboarderCWB;21023193]Can anyone help me? Size this code to player's screen?:
[lua]local hp = ( LocalPlayer():Health() )[/lua][/QUOTE]
You could do:
[lua]
surface.SetFont( "FontYouWant" )
local w, h = surface.GetTextSize( LocalPlayer():Health() )
[/lua]
"w" being the width of the health and "h" being the height.
And then from there position it accordingly.
If you need a list of fonts...
[URL="http://wiki.garrysmod.com/images/c/cf/Fonts.png"]http://wiki.garrysmod.com/images/c/cf/Fonts.png[/URL]
You could do:
[lua]
surface.SetFont( "FontYouWant" )
local w, h = surface.GetTextSize( LocalPlayer():Health() )
[/lua]
Thanks, but the health is the width for my draw.RoundedBox. I have a health bar, not just health text.
Sorry, you need to Log In to post a reply to this thread.