• DrawPoly lua
    6 replies, posted
Hey guys. I am trying to make an HUD, and starting off, i am trying to make a Square which isn't straight. As i understood i will need to use DrawPoly. This is the code i've got so far, just for testing, but i only get a Triangle. [CODE] local square = { { x = 100, y = 100 }, { x = 100, y = 200 }, { x = 200, y = 100 }, {x = 200, y = 200 } } hook.Add("HUDPaint","testing_this",function() surface.SetDrawColor( 255, 0, 0, 255 ) draw.NoTexture() surface.DrawPoly( square ) end)[/CODE]
Your shape cant be filled. terrible drawn example (left yours) [T]http://s14.directupload.net/images/141117/b66kf3yp.png[/T] try [CODE] local square = { { x = 100, y = 100 }, { x = 100, y = 200 }, { x = 200, y = 200 }, {x = 200, y = 100 } } hook.Add("HUDPaint","testing_this",function() surface.SetDrawColor( 255, 0, 0, 255 ) draw.NoTexture() surface.DrawPoly( square ) end) [/CODE]
[QUOTE=gamerpaddy;46509401]Your shape cant be filled. terrible drawn example (left yours) [T]http://s14.directupload.net/images/141117/b66kf3yp.png[/T] try [CODE] local square = { { x = 100, y = 100 }, { x = 100, y = 200 }, { x = 200, y = 200 }, {x = 200, y = 100 } } hook.Add("HUDPaint","testing_this",function() surface.SetDrawColor( 255, 0, 0, 255 ) draw.NoTexture() surface.DrawPoly( square ) end) [/CODE][/QUOTE] ohh right.. Haha thanks.. [editline]17th November 2014[/editline] Nope, it isn't working, nothing appears now.
Whoops, should work now [CODE]local square = { { x = 100, y = 100 }, { x = 200, y = 100 }, { x = 200, y = 200 }, { x = 100, y = 200 } }[/CODE] (Start is allways top left, so its going top left, top right, bottom right, bottom left.)
[QUOTE=gamerpaddy;46509566]Whoops, should work now [CODE]local square = { { x = 100, y = 100 }, { x = 200, y = 100 }, { x = 200, y = 200 }, { x = 100, y = 200 } }[/CODE] (Start is allways top left, so its going top left, top right, bottom right, bottom left.)[/QUOTE] ahh thanks! :D [editline]17th November 2014[/editline] Another thing, how can i make a square with only the outline of it? Like that square, but instead of filling the inside, only showing an outline?
Draw lines instead of a rectangle
[QUOTE=Exho;46510532]Draw lines instead of a rectangle[/QUOTE] I found the surface.DrawLine, but it doesn't have an option to define how many pixels it'll have. I gess i can make it a smaller box in the size of a line.
Sorry, you need to Log In to post a reply to this thread.