3B00DG4MER Posted April 26, 2014 Posted April 26, 2014 Hello,Today i have made a NEWS System is it possible to make the rectangle rounded like this ? SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
3B00DG4MER Posted April 26, 2014 Author Posted April 26, 2014 Just use a picture and that's it ^^ You mean can't make it rounded ? SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
3B00DG4MER Posted April 26, 2014 Author Posted April 26, 2014 I don't think so. Thanks SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
tosfera Posted April 26, 2014 Posted April 26, 2014 I don't think so. Thanks There is a way, 'chatbubbles' ( the resource ) used this way. It's an insane way. They created a rectangle that kept growing 1px bigger in the width and moving 1px down to finally create the rounded rectangle. I wouldn't recommend it, but it's a way. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Gallardo9944 Posted April 26, 2014 Posted April 26, 2014 you actually can create multiple rectangles with "for" vertically by 1 pixel and change the size as it goes. Like this local x,y = guiGetScreenSize() local sx,sy = 400,200 local size = 45 -- pixel size to cut function performRendering() for i=1,sy do local dg = math.min(i,size) -- limit it to the size if i > sy-size then dg = sy-math.max(sy-size,i) -- limit it to the size for bottom parts end local csx = sx-1/dg*size -- use our lovely y = k/x function dxDrawRectangle(x/2-csx/2,y/2-sy/2+i,csx,1,tocolor(0,0,0,200)) -- draw the magic at the middle end end addEventHandler("onClientRender",getRootElement(),performRendering) But it WILL loose the quallity and it WILL look a bit weird. You also can draw that more frequently than 1 pixel, but keep in mind that slow computers will degrade on performance. Code Debugger - Minimalistic MTA debug line replacement
Castillo Posted April 26, 2014 Posted April 26, 2014 I don't see what's the point of that, what's wrong with using a image? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
3B00DG4MER Posted April 26, 2014 Author Posted April 26, 2014 I don't see what's the point of that, what's wrong with using a image? it's take download SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
tosfera Posted April 26, 2014 Posted April 26, 2014 I don't see what's the point of that, what's wrong with using a image? it's take download An image like this wont take more than 100kb, maybe even less if it's small. If you don't want to take the download part. Don't make these rounding corners. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
3B00DG4MER Posted April 26, 2014 Author Posted April 26, 2014 you actually can create multiple rectangles with "for" vertically by 1 pixel and change the size as it goes. Like this local x,y = guiGetScreenSize() local sx,sy = 400,200 local size = 45 -- pixel size to cut function performRendering() for i=1,sy do local dg = math.min(i,size) -- limit it to the size if i > sy-size then dg = sy-math.max(sy-size,i) -- limit it to the size for bottom parts end local csx = sx-1/dg*size -- use our lovely y = k/x function dxDrawRectangle(x/2-csx/2,y/2-sy/2+i,csx,1,tocolor(0,0,0,200)) -- draw the magic at the middle end end addEventHandler("onClientRender",getRootElement(),performRendering) But it WILL loose the quallity and it WILL look a bit weird. You also can draw that more frequently than 1 pixel, but keep in mind that slow computers will degrade on performance. Thanks SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
3B00DG4MER Posted April 26, 2014 Author Posted April 26, 2014 I don't see what's the point of that, what's wrong with using a image? it's take download An image like this wont take more than 100kb, maybe even less if it's small. If you don't want to take the download part. Don't make these rounding corners. Okay okay i'll make a image SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
arezu Posted April 27, 2014 Posted April 27, 2014 If you want to make the rounded rectangle scalable, then it's better if you just make an image of the corner and draw everything else with dxDrawRectangle, then the download should be less than 1kb (more in photoshop, because of useless photoshop info in the image)
Dealman Posted April 27, 2014 Posted April 27, 2014 They would have to download the image once, and then that's all it renders. It is way more efficient than doing those calculations with every frame. And easier. And looks better. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Moderators IIYAMA Posted April 27, 2014 Moderators Posted April 27, 2014 Well all you need is white 4 corners.... (white because then you can set up your own colour) Perfect rounded corners, it only cost a lot loop power to generate it. (one time of course) See See why the corners must be white Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Moderators IIYAMA Posted April 28, 2014 Moderators Posted April 28, 2014 3B00DG4MER: thank you . Solved. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
raynner Posted August 6, 2017 Posted August 6, 2017 function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 0, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, postGUI); --> Border dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right end end Just add it inside your rendering function next to the rectangle you want it to become round.. don´t is necessari
NeXuS™ Posted August 6, 2017 Posted August 6, 2017 @raynner, this is already a solved post, and was created back in April... 1 Did I help you? NeXuS™#0001
MisterQuestions Posted August 6, 2017 Posted August 6, 2017 Just as a simple solution, having a circle image and drawing sections for corners its better, simple and has a better performance than using maths everyframe. "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Recommended Posts