Now this is probably a super simple and stupid question to ask, but...
I've seen in various HUD pictures (NOT downloadable examples that I could look at the code of) that they have "angled" (like a draw.RoundedBox but at a 45 degree angle) with perfect anti aliasing and everything. How would I do this kind of thing? Hopefully it's relatively simple.
People who make HUDs use [url=http://wiki.garrysmod.com/page/surface/DrawPoly]surface.DrawPoly[/url] for angular looking designs.
[QUOTE=LUModder;46204087]People who make HUDs use [url=http://wiki.garrysmod.com/page/surface/DrawPoly]surface.DrawPoly[/url] for angular looking designs.[/QUOTE]
Interesting, thanks.
[editline]ono[/editline]
Uh it's a liiiiitle bit confusing... How would I [i]center[/i] it? Please tell me there's an easier way than doing all this math manually.
Helpful math shortcuts:
ScrH()
ScrW()
math.Rand(min,max)
These will center
ScrW()/2
ScrH()/2
Going by the wiki, you could use [url=http://wiki.garrysmod.com/page/cam/PushModelMatrix]cam.PushModelMatrix[/url]
[code]
render.PushFilterMag( TEXFILTER.ANISOTROPIC )
render.PushFilterMin( TEXFILTER.ANISOTROPIC )
local m = Matrix( )
m:Translate( xpos, ypos )
m:Rotate( Angle( 0, amt, 0 ) )
m:Scale( vector_desired_scale )
cam.PushModelMatrix( m )
draw.RoundedBox( ... )
cam.PopModelMatrix( )
render.PopFilterMag( )
render.PopFilterMin( )[/code]
Don't know if that will accomplish the desired anti-aliasing, but it seems pretty straightforward and doesn't involve managing a bunch of polygons yourself.
[QUOTE=LUModder;46204192]Helpful math shortcuts:
ScrH()
ScrW()
math.Rand(min,max)
These will center
ScrW()/2
ScrH()/2[/QUOTE]
I know about those.
What I mean is, it seems almost impossible to center this...
[lua]local polydata = {}
polydata[1] = {}
polydata[1][1] = { x = 650, y = 0 }
polydata[1][2] = { x = 750, y = 0 }
polydata[1][3] = { x = 750, y = 50 }
polydata[1][4] = { x = 650, y = 50 }
polydata[1][5] = { x = 600, y = 0 }[/lua]
And have all of the shape still be perfectly intact, yet centered (horizontally)
[lua]local polydata = {}
polydata[1] = {}
polydata[1][1] = { x = ScrW() + 50, y = 0 }
polydata[1][2] = { x = ScrW() + 150, y = 0 }
polydata[1][3] = { x = ScrW() + 150, y = 50 }
polydata[1][4] = { x = ScrW() + 50, y = 50 }
polydata[1][5] = { x = ScrW(), y = 0 }[/lua]
makes em disappear
[QUOTE=RonanZer0;46204255]I know about those.
What I mean is, it seems almost impossible to center this...
[lua]local polydata = {}
polydata[1] = {}
polydata[1][1] = { x = 650, y = 0 }
polydata[1][2] = { x = 750, y = 0 }
polydata[1][3] = { x = 750, y = 50 }
polydata[1][4] = { x = 650, y = 50 }
polydata[1][5] = { x = 600, y = 0 }[/lua]
And have all of the shape still be perfectly intact, yet centered (horizontally)
[lua]local polydata = {}
polydata[1] = {}
polydata[1][1] = { x = ScrW() + 50, y = 0 }
polydata[1][2] = { x = ScrW() + 150, y = 0 }
polydata[1][3] = { x = ScrW() + 150, y = 50 }
polydata[1][4] = { x = ScrW() + 50, y = 50 }
polydata[1][5] = { x = ScrW(), y = 0 }[/lua]
makes em disappear[/QUOTE]
Because you're drawing them off the screen. ScrW() returns the width of the screen so if you add to it it will be past the bounds of the screen.
Sorry, you need to Log In to post a reply to this thread.