Jump to content

dxDrawText Relative?


Recommended Posts

Posted

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 :D

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.

Posted

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

Guest Guest4401
Posted

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 

Posted

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 

Guest Guest4401
Posted
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.

Posted
@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 :(

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