Jump to content

useful function x2


Master_MTA

Recommended Posts

this function about drawing rounded rectangle it's have 100% work correctly (i hope that :D )

so there is function to draw rounded rectangle with dxDrawCircle but it's not work correctly when u but the postgui value to true

and change it's color so there my source code enjoy



function dxDrawRoundedRectangle(x,y,width,height,raduis,color,postgui)

dxDrawRectangle(x,y+raduis,width+1,height-(raduis*2),color,postgui)--horezantal rectangle
dxDrawRectangle(x+raduis,y,width-(raduis*2),height+1,color,postgui)--vertical rectangle

for k=180,270 do--left top
	local co=math.cos(math.rad(k))* raduis
	local si=math.sin(math.rad(k))* raduis
	dxDrawLine((x+raduis)+co,(y+raduis)+si,x+raduis,y+raduis,color,1,postgui)
end
for k=270,360 do--right top
	local co=math.cos(math.rad(k))* raduis
	local si=math.sin(math.rad(k))* raduis
	dxDrawLine((x+width-raduis)+co,(y+raduis)+si,x+width-raduis,y+raduis,color,1,postgui)
end

for k=90,180 do--left bottom
	local co=math.cos(math.rad(k))* raduis
	local si=math.sin(math.rad(k))* raduis
	dxDrawLine((x+raduis)+co,(y+height-raduis)+si,x+raduis,y+height-raduis,color,1,postgui)
end
local k=360
while(k<=(360+90))do
if k~= 360 then
	local co=math.cos(math.rad(k))* raduis
	local si=math.sin(math.rad(k))* raduis
	dxDrawLine((x-raduis+width)+co,(y+height-raduis)+si,x+width-raduis,y+height-raduis,color,1,postgui)
	
end
	k=k+1;
end

end

i think there is no need to explain the arguments   

enjoy

  • Like 1
  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...