mehmet Posted March 9, 2019 Share Posted March 9, 2019 Hello, I want to create a button with rounded corners. Pictures will not work. I need to create a dynamic button. How to do it right? and well optimized. They say this is a bad way for server performance. + visible pixels ( 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) Link to comment
TRtam Posted March 9, 2019 Share Posted March 9, 2019 https://wiki.multitheftauto.com/wiki/DxDrawCircle this function have a example to draw a rounded rectangle Link to comment
mehmet Posted March 9, 2019 Author Share Posted March 9, 2019 17 minutes ago, TRtam said: https://wiki.multitheftauto.com/wiki/DxDrawCircle this function have a example to draw a rounded rectangle Is this method better? Link to comment
Moderators Patrick Posted March 9, 2019 Moderators Share Posted March 9, 2019 36 minutes ago, mehmet said: Is this method better? Better. Link to comment
mehmet Posted March 9, 2019 Author Share Posted March 9, 2019 (edited) 13 minutes ago, stPatrick said: Better. I make the menu. If rendering 100-200 rectangle is a lot? (1 button = 9 Rectangle) Edited March 9, 2019 by mehmet Link to comment
Moderators Patrick Posted March 10, 2019 Moderators Share Posted March 10, 2019 Yes, there are many, but there is no better solution. Only the images. Link to comment
mehmet Posted March 10, 2019 Author Share Posted March 10, 2019 1 hour ago, stPatrick said: Yes, there are many, but there is no better solution. Only the images. can CEF be better? Link to comment
Moderators IIYAMA Posted March 10, 2019 Moderators Share Posted March 10, 2019 You might also be able to use CEF to create button textures. (Haven't done it before, but it looks to me that it is very well possible) Link to comment
mehmet Posted March 10, 2019 Author Share Posted March 10, 2019 4 hours ago, IIYAMA said: You might also be able to use CEF to create button textures. (Haven't done it before, but it looks to me that it is very well possible) Thank you, but I decided to use an image. Link to comment
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