MTA Team qaisjp Posted May 19, 2011 MTA Team Posted May 19, 2011 I would like to create a circular radar instead of a rectangular radar, is there any way to achieve this?
karlis Posted May 19, 2011 Posted May 19, 2011 only thing i could think about is to use alot of dxDrawImageSection to make close to circular shape, then using pretty fat border ring to hide the not-preciseness of that shape.
MTA Team qaisjp Posted May 19, 2011 Author MTA Team Posted May 19, 2011 Darn. That aint gonna be easy.
karlis Posted May 19, 2011 Posted May 19, 2011 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.
MTA Team qaisjp Posted May 19, 2011 Author MTA Team Posted May 19, 2011 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.
karlis Posted May 19, 2011 Posted May 19, 2011 then support this suggestion viewtopic.php?f=102&t=26812 anyway, i cant do it all for you, but if u get stuck/need assistance, feel free to ask
Aibo Posted May 19, 2011 Posted May 19, 2011 i made this once in my «bigradar» resource (with zoom and all that): since dxDrawImage/Section only draws rectangular stuff, im totally supporting the dx image «masking» suggestion. 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.
karlis Posted May 19, 2011 Posted May 19, 2011 i made this once in my «bigradar» resource (with zoom and all that): since dxDrawImage/Section only draws rectangular stuff, im totally supporting the dx image «masking» suggestion. 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?
MTA Team qaisjp Posted May 19, 2011 Author MTA Team Posted May 19, 2011 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.
Aibo Posted May 19, 2011 Posted May 19, 2011 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.
karlis Posted May 19, 2011 Posted May 19, 2011 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.
Aibo Posted May 19, 2011 Posted May 19, 2011 it should be possible by stacking many image sections and making round shape out of it. i'm not saying it's impossible, it's just crazy
MTA Team qaisjp Posted May 20, 2011 Author MTA Team Posted May 20, 2011 What I mean is, a circular radar area (in the HUD radar). Cos when you make a rectangular radar area I feel it looks like shit, I feel it is better to have a circular radar area.
MTA Team qaisjp Posted May 20, 2011 Author MTA Team Posted May 20, 2011 (edited) ^^ wtf is that supposed to mean?! lol EDIT: Omg idiot deleted his post somehow. Edited May 20, 2011 by Guest
karlis Posted May 20, 2011 Posted May 20, 2011 oh darn then i got it wrong. itll be very hard, cuz you will need to draw it with countless rectangular radar areas
DiSaMe Posted May 20, 2011 Posted May 20, 2011 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.
karlis Posted May 20, 2011 Posted May 20, 2011 ^^ wtf is that supposed to mean?! lolEDIT: Omg idiot deleted his post somehow. thats called moderating
karlis Posted May 20, 2011 Posted May 20, 2011 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.
MTA Team qaisjp Posted May 20, 2011 Author MTA Team Posted May 20, 2011 ^^ wtf is that supposed to mean?! lolEDIT: 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.
karlis Posted May 20, 2011 Posted May 20, 2011 just do all the radar areas, then loop tru a table with them...
karlis Posted May 21, 2011 Posted May 21, 2011 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 , and tested, it works EDIT: made it more accurate
MTA Team qaisjp Posted May 21, 2011 Author MTA Team Posted May 21, 2011 Wow, I will try that as soon as I get my scripting laptop back. Thanks for your help.
MX_Master Posted May 21, 2011 Posted May 21, 2011 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` )
karlis Posted May 22, 2011 Posted May 22, 2011 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now