Victor214 Posted May 30, 2012 Posted May 30, 2012 Hello! I would like to know How i can use the function dxDrawText , with relative values. Can someone help me and give an Example? Thanks
Castillo Posted May 30, 2012 Posted May 30, 2012 Maybe this could help: viewtopic.php?f=91&t=33478&p=350398 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Reflex# Posted May 30, 2012 Posted May 30, 2012 Look,its easy,i show you part of time script,what help me to do,Dracula First you must know that,this is only client function. But i dont show all script addEventHandler("onClientRender",root, function() dxDrawText([TEXT],0,0,10,10,tocolor(255,157,0,255),0.6,"bankgothic") end ) The first is position of text 0=x,0=y. Then goes color (255,157,0,255)(Red,Green,Blue,Aplha) alpha must be 255 always,if it 0,text dont show. Then 0.6,its size of text And "bankgothic" is type of text,it can be Arial,Tahoma and else I think my post is not so useful,because Solid was faster and show Wiki url,but...i just show,like you ask. Scripting in lua
Castillo Posted May 31, 2012 Posted May 31, 2012 @Reflex: Victor already knows how to use the function, he was asking how to draw the text with relative values for the position. P.S: My link wasn't for the wiki. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Guest Guest4401 Posted May 31, 2012 Posted May 31, 2012 I might be wrong but I guess, You should just multiply exact relative position with maximum width & height to get the absolute position. local x,y = guiGetScreenSize() local rX = 0.5 local rY = 0.5 local aX = x*rX local aY = y*rY
Stanley Sathler Posted May 31, 2012 Posted May 31, 2012 Do you wanna convert absolute to relative? Solidsnake sent to you the link, just must read it. function AbsoluteToRelative( X, Y ) local rX, rY = guiGetScreenSize() local x = X/rX local y = Y/rY return x, y end -- Example made by laserlaser Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Guest Guest4401 Posted May 31, 2012 Posted May 31, 2012 Do you wanna convert absolute to relative? Solidsnake sent to you the link, just must read it. function AbsoluteToRelative( X, Y ) local rX, rY = guiGetScreenSize() local x = X/rX local y = Y/rY return x, y end -- Example made by laserlaser He wants to use relative positions in dxDrawText. So relative to absolute will help him do so.
Stanley Sathler Posted May 31, 2012 Posted May 31, 2012 I said your example is wrong? I showed another way, returning the relative values. Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Reflex# Posted May 31, 2012 Posted May 31, 2012 @Reflex: Victor already knows how to use the function, he was asking how to draw the text with relative values for the position.P.S: My link wasn't for the wiki. Oh sorry Solid Scripting in lua
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