Jump to content

Circular Radar


qaisjp

Recommended Posts

making yet another hud resource?

EDIT:wont also be that hard, remember this function:

radius^2=x^2+y^2, and you can generate the size even with pretty good preciseness

but this works assuming x and y is 0 at the center of ring.

Link to comment

But I'm making a radar, I have to check if the position is on the botttom left hud + make an image + it becomes partial if partially off hud. it should be exactly like createRadarArea but instead rectangular, it should be circular!

Doing that isn't easy, I sux at maths.

Link to comment

i made this once in my «bigradar» resource (with zoom and all that):

Region2011_3135358_2218714.png

since dxDrawImage/Section only draws rectangular stuff, im totally supporting the dx image «masking» suggestion. :D

also, the map for that radar will be huge (if you want decent radar map quality), mine used 6000x6000 map for fullscreen radar and 2048x2048 for a small hud one, and still it was crappy when zoomed in.

imo, it is not worth it right now.

Link to comment
i made this once in my «bigradar» resource (with zoom and all that):

Region2011_3135358_2218714.png

since dxDrawImage/Section only draws rectangular stuff, im totally supporting the dx image «masking» suggestion. :D

also, the map for that radar will be huge (if you want decent radar map quality), mine used 6000x6000 map for fullscreen radar and 2048x2048 for a small hud one, and still it was crappy when zoomed in.

imo, it is not worth it right now.

but how you think, using this + additional rectangles that make ring shape with offset rotation pos would work good?

Link to comment

Wait wait, is this feature already in ur bigradar resource. Does it support flashing? The truth I want circular is because rectangular looks crap in the original radar. But your bigradar "radar" makes it look cool.

If the feature is in ur bigradar res, please can I modify your resource to use only the radar (as I don't need the other features?) If I can, I will give you credits for the radar.

Link to comment

this feature is not in the bigradar resource currently (map is too big, more than 1MB).

hm, where did you see a rectangular radar anyway? are you sure you're not confusing radar with radar area? if you want rounded radar area, then there's nothin can be done, it's rectangular.

well maybe something can be done by using some colshapes and making custom displayed circular radar areas (or not, since there's no circles anywhere), but i think it's not worth it.

Link to comment
this feature is not in the bigradar resource currently (map is too big, more than 1MB).

hm, where did you see a rectangular radar anyway? are you sure you're not confusing radar with radar area? if you want rounded radar area, then there's nothin can be done, it's rectangular.

well maybe something can be done by using some colshapes and making custom displayed circular radar areas (or not, since there's no circles anywhere), but i think it's not worth it.

it should be possible by stacking many image sections and making round shape out of it.

Link to comment
It's not hard. No matter how many DX image sections need to be drawn, MTA does this for you as long as you script that properly. It doesn't even take many rectangles to draw a circle.

we sorted that he need radar areas, not radar.

Link to comment
^^ wtf is that supposed to mean?! lol

EDIT: Omg idiot deleted his post somehow.

thats called moderating

idiot == the guy who wrote that.

Ontopic now:

I know you can make multiple radar areas to make a circle but that will be hard to calculate who is in what and all.

Link to comment

sry for doublepost, but some time has passed, and you would not see edit.

i made a function that generates ring out of rectangles, it might be useful for your purpose.

  
function generateRectanglesInRing(radius,accuracy) 
    local n=2 
    local rT={} 
    rT[1] = {} 
    local smallRadius=radius-accuracy 
    local xOff=smallRadius 
    local yOff=(radius^2-xOff^2)^0.5 
    rT[1][1],rT[1][2],rT[1][3],rT[1][4]=math.ceil(-xOff),math.ceil(-yOff),math.ceil(xOff*2),math.ceil(yOff*2) 
    while true do 
        rT[n]={} 
        rT[n+1]={} 
        xOff=(smallRadius^2-yOff^2)^0.5 
        yOff=(radius^2-xOff^2)^0.5 
        rT[n][1],rT[n][2],rT[n][3],rT[n][4]=-xOff,-yOff,xOff*2,yOff-math.abs(rT[n-1][2]) 
        rT[n+1][1],rT[n+1][2],rT[n+1][3],rT[n+1][4]=-xOff,math.abs(rT[n-1][2]),rT[n][3],rT[n][4] 
        if yOff>=smallRadius then 
            rT[n][2],rT[n][4]=-smallRadius,smallRadius-math.abs(rT[n-1][2]) 
            rT[n+1][4]=rT[n][4] 
            break 
        end 
        n=n+2 
    end 
    for n=2,#rT do 
        for k=1,4 do 
            rT[n][k]=math.ceil(rT[n][k]) 
        end 
        if rT[n-1][1]==rT[n][1] and rT[n-1][2]==rT[n][2] then 
            table.remove(rT,n) 
        end 
    end 
    return rT 
end 
  

radius=how big the ring need to be

accuracy=how big offset in radius can there be, use 0.01(maybe higher works too, didn't test) for perfect ring, and bigger for smaller amount of rectangles.

it returns following table

table={ {posX1,posY1,sizeX1,sizeY1},

{posX2,posY2,sizeX2,sizeY2},

{posX3,posY3,sizeX3,sizeY3},

...

}

where the center of ring is x=0, y=0

NOTE: a bit of lag spike when function is called with big accuracy(like 0.05 or smaller)

see, not that complicated :D, and tested, it works :)

EDIT: made it more accurate

Link to comment

Circle/rectangle radar areas can be done by dxDrawImageSection on the any custom rectangle radar. Just make white circle/rectangle as image on transparent background and so you can show it's rotated parts where needed. To recolor this circle/rectangle use `color` argument in the dxDrawImageSection. For example, for the red and 50% transparent circle, use tocolor(255,0,0,128) as `color` argument in it.

But now is impossible to make normal circle custom radar. Don't try to make it with many rectangle pieces. Better way - open an issue (feature) on then bug tracker. Or just support this feature on the bug tracker.

dxDrawMask ( `all parameters from dxDrawImageSection` ) 

Link to comment
Circle/rectangle radar areas can be done by dxDrawImageSection on the any custom rectangle radar. Just make white circle/rectangle as image on transparent background and so you can show it's rotated parts where needed. To recolor this circle/rectangle use `color` argument in the dxDrawImageSection. For example, for the red and 50% transparent circle, use tocolor(255,0,0,128) as `color` argument in it.

But now is impossible to make normal circle custom radar. Don't try to make it with many rectangle pieces. Better way - open an issue (feature) on then bug tracker. Or just support this feature on the bug tracker.

dxDrawMask ( `all parameters from dxDrawImageSection` ) 

ill still try it with those rectangles, did write too much to stop now.

and suggestion of that is already made(check topic by me)

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