Jump to content

dxDrawText Relative?


Recommended Posts

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.

Link to comment
Guest Guest4401

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 

Link to comment

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 

Link to comment
Guest Guest4401
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.

Link to comment

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