Jump to content

draw empty circle


Recommended Posts

  • Moderators
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
Link to post

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

Link to post

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
Link to post

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