Jump to content

draw empty circle


Tekken

Recommended Posts

Posted

Hi I'd like to draw an empty circle like this one:

spacer.png

I'm currently using the example from https://wiki.multitheftauto.com/wiki/DxDrawLine but it's not a perfect circle and yet very demanding.

I was wondering if there's a better way of doing this

 

Thanks :)

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

  • Moderators
Posted (edited)
3 hours ago, Tekken said:

very demanding

This one is less demanding:

https://wiki.multitheftauto.com/wiki/DxDrawCircle

 


 

3 hours ago, Tekken said:

I was wondering if there's a better way of doing this

Photoshop:

Create a png image (256 × 256), with ⭕.

  • Give ⭕ black borders.
  • Fill ⭕ with a white colour if always filled, else use behind the image.
     

If filled with a white colour, it can be re-coloured with:

https://wiki.multitheftauto.com/wiki/DxDrawImage

tocolor(255,255,255,255)

 


 

Create texture with mipmaps enabled:

https://wiki.multitheftauto.com/wiki/DxCreateTexture

 

What does mipmaps do?

https://flylib.com/books/en/1.541.1.66/1/

 

Try to give the image

 

 

Edited by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   ?

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

dxDrawCircle returns a filled circle, the idea behind this is to create those circles as health indicators.

Haven’t tried making alpha 0 to center color tho

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

  • Moderators
Posted (edited)
21 minutes ago, Tekken said:

dxDrawCircle returns a filled circle

Oh sorry, I meant this one:

https://wiki.multitheftauto.com/wiki/Shader_examples#dxDrawCircle

 

but you still need that image to make the borders smooth.

Edited by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   ?

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted (edited)

try this

function dxDrawCircle2( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI )
		if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then
			return false
		end

		radius = type( radius ) == "number" and radius or 50
		width = type( width ) == "number" and width or 5
		startAngle =  type( startAngle ) == "number" and startAngle or 0, 0, 360
		stopAngle =  type( stopAngle ) == "number" and stopAngle or 360, 0, 360
		color = color or tocolor( 255, 255, 255, 100 )
		postGUI = type( postGUI ) == "boolean" and postGUI or false

		startAngle = startAngle-90;
		stopAngle = stopAngle-90;

		if ( stopAngle < startAngle ) then
			local tempAngle = stopAngle
			stopAngle = startAngle
			startAngle = tempAngle
		end

		local multiby = 50;

		if (radius >= 1000) then multiby = 3000; end

		for i = startAngle, stopAngle, multiby/radius do
			local startX = math.cos( math.rad( i ) ) * ( radius - width )
			local startY = math.sin( math.rad( i ) ) * ( radius - width )
			local endX = math.cos( math.rad( i ) ) * ( radius + width )
			local endY = math.sin( math.rad( i ) ) * ( radius + width )

			dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI )
		end

		return true
	end

i use this method with a circle image png

 

Edited by Furzy

FURZY'S CUSTOM WEAPON SYSTEM

Discord: Furzy#4125

 

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...