Roundedbox around anotherone

Hello,

I have a question. I want a roundedbox around this (oultine), but not that so you can see it underneath the layer, because im using transparency.
I already tryed a few things but not worked.


 	draw.RoundedBox(height * 1.1, 750, 975, 410, 65, Color(0, 0, 0, 235)) 
	
	draw.SimpleText(health, "Health", x + width - 35, 1005 + 1.9 * .5, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)

	render.SetScissorRect(50, 1200, x + (health / maxHealth * 390), 10 + 10, true) 
	
	draw.RoundedBox(height * 1.1, 750, 975, 410, 65, color_white) 
		
	draw.SimpleText(health, "Health", x + width - 35, 1005 + 1.9 * .5, color_black, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)  

surface.DrawOutlinedRect

[editline]10th September 2017[/editline]

Or just 4

surface.DrawLine

Why do you keep switching accounts?

But to answer your question you could probably use stencils. This is for making hollow circles but you can easily change it to rounded boxes.


local alphaOne = Color(0, 0, 0, 1)

draw.CircleOutline = function(x, y, radius, col, thickness)
	render.ClearStencil()

	render.SetStencilEnable(true)
		render.SetStencilReferenceValue(1)
		render.SetStencilWriteMask(1)
		render.SetStencilTestMask(1)

		render.SetStencilPassOperation(STENCIL_INCR)

		draw.Circle(x, y, radius - thickness, alphaOne)

		render.SetStencilCompareFunction(STENCIL_NOTEQUAL)
		render.SetStencilPassOperation(STENCIL_KEEP)

		draw.Circle(x, y, radius, col)
	render.SetStencilEnable(false)
end


Uhm, im sorry but i really don’t know how i would apply the RoundedBox to this. I want a hollow roundedbox (armor bar) it would go from right to left when you lose armor. But how would i do this?

With a material.

What a help :unimpressed:

Well when people actually help you then you just beg them to give you something you can paste instead of actually trying to learn.

He’s basically done the work for you, just replace both instances of draw.Circle with draw.RoundedBox.
Go mess with it, you can do it!

Thanks for the motivation. Should it be like this?


 local alphaOne = Color(0, 0, 0, 1)

draw.CircleOutline = function(x, y, radius, col, thickness)
	render.ClearStencil()

	render.SetStencilEnable(true)
		render.SetStencilReferenceValue(1)
		render.SetStencilWriteMask(1)
		render.SetStencilTestMask(1)

		render.SetStencilPassOperation(STENCIL_INCR)

		draw.RoundedBox( 0, 200, 200, 250, 350, Color(255, 255, 255, 255) ) 

		render.SetStencilCompareFunction(STENCIL_NOTEQUAL)
		render.SetStencilPassOperation(STENCIL_KEEP)

		draw.RoundedBox( 0, 200, 200, 250, 350, Color(255, 255, 255, 255) ) 
	render.SetStencilEnable(false)
end
 

Try it