Jump to content

dxDrawCircle


mehmet

Recommended Posts

Posted (edited)

Hello guys,

 I use dxdrawcircle function, how do I draw a circle? and how to make a circle transparent? shader?efed35-20170505160427_1.jpg

function dxDrawRoundedRectangle(x, y, rx, ry, color, radius)
    rx = rx - radius * 2
    ry = ry - radius * 2
    x = x + radius
    y = y + radius

    if (rx >= 0) and (ry >= 0) then
        dxDrawRectangle(x, y, rx, ry, color)
        dxDrawRectangle(x, y - radius, rx, radius, color)
        dxDrawRectangle(x, y + ry, rx, radius, color)
        dxDrawRectangle(x - radius, y, radius, ry, color)
        dxDrawRectangle(x + rx, y, radius, ry, color)

        dxDrawCircle(x, y, radius, 180, 270, color, color, 7)
        dxDrawCircle(x + rx, y, radius, 270, 360, color, color, 7)
        dxDrawCircle(x + rx, y + ry, radius, 0, 90, color, color, 7)
        dxDrawCircle(x, y + ry, radius, 90, 180, color, color, 7)
    end
end


addEventHandler( "onClientRender", root,
    function()
        dxDrawRoundedRectangle(350, 50, 100, 100, tocolor(0, 255, 0, 255), 20)
    end
)

 

Edited by mehmet
Posted
1 minute ago, Overkillz said:

Just create more circles leaving some spaces between them ...

 

But in the center nothing should be

Posted
2 minutes ago, Overkillz said:

Read carefully the function. It allows you to leave the middle empty.

Quote

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • startAngle: An integer representing the angle of the first point of the circle.
  • stopAngle: An integer representing the angle of the last point of the circle.
  • theColor: An integer of the hex color, produced using tocolor or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
  • theCenterColor: An integer of the hex color, produced using tocolor or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
  • segments: An integer ranging from 3-1024 representing how many triangles are used to form the circle, more segments = smoother circle. Note: using lots of segments may cause lag.
  • ratio: Ratio between width and height, e.g: 2 would mean that the width of the circle is 2 times the height.
  • postGUI: A bool representing whether the circle should be drawn on top of or behind any ingame GUI (rendered by CEGUI).

 

where?

Posted
15 minutes ago, mehmet said:

 

where?

Well, mybad. I have realized that this function has been updated. Previously there was the same function but made with dxDrawLines. It used to be a bit blurred but u could reach what are u looking for. Probabilly u will need to work with shaders or dxDrawImage/dxDrawImageSection

Posted
2 minutes ago, Overkillz said:

Well, mybad. I have realized that this function has been updated. Previously there was the same function but made with dxDrawLines. It used to be a bit blurred but u could reach what are u looking for. Probabilly u will need to work with shaders or dxDrawImage/dxDrawImageSection

for example, what is a Shader? circle.fx? https://wiki.multitheftauto.com/wiki/Shader_examples
and how to work with them?

3 minutes ago, Dimos7 said:

Put center color invsible

dxDrawCircle(950, 500, 250, 360, 0, tocolor(0, 0, 0, 1000),invsible, 100)

so?

Posted
6 hours ago, Dimos7 said:

dxDrawCircle(950, 500, 250, 360, 0, tocolor(0, 0, 0, 255), tocolor (0, 0, 0, 0),100)

 

png&tknv=v2&size=2048x2048


It makes a fade effect.
I need the middle empty

png&tknv=v2&size=1350x640

Posted
5 minutes ago, Dimos7 said:

Make more than one and make be in center of and make it

I didn't understand. show me an example? you speak Russian?))

Posted

I would do that using image.

  • Like 1

Please do not PM me with scripting related question nor support, use the forums instead.

  • Moderators
Posted

You might be able to do that with a mask shader:

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

  • Like 1

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

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted (edited)
24 minutes ago, mehmet said:

with this Shader, can I make the center empty? or can I give the image an effect?

To cut out stuff: nightly.multitheftauto.com/files/shaders/shader_hud_mask.zip

But as @DNL291 said, an image might be easier. (also for the effect)

 

 

 

 

 

 

 

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 

 

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