Jump to content

Problem with dx


papam77

Recommended Posts

Posted

Do you just want to draw a rectangle on the top of the screen? Then use this:

local w, h = guiGetScreenSize () 
height = 20 --20 is an absolute value. You can use h/10 for example, to make it relative. 
dxDrawRectangle ( 0, 0, w, height, tocolor ( 0, 125, 255, 255 ) ) 

Posted

And what about dxDrawText?

http://www.img.tpx.cz/uploads/relative.png

http://www.img.tpx.cz/uploads/relative2.png

  
local sX, sY = guiGetScreenSize() 
  
function design () 
showCursor ( true ) 
  
-- Header -- 
dxDrawRectangle ( 0, 0, sX/1, sY/20, tocolor ( 0, 125, 255, 255 ) ) 
dxDrawText("Sign In", sX/1.1, 0, sX/2, sY/2, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false) 
end 
addEventHandler ("onClientRender", root, design ) 
  
  

It is not relative, but why? I mean the text scale

Posted

No, it isn't relative, but then why don't you try to make it relative? Example:

local sX, sY = guiGetScreenSize() 
dxDrawText("Sign In", sX/1.1, 0, sX/2, sY/2, tocolor(255, 255, 255, 255), sX*0.0016, "default", "left", "top", false, false, true, false, false) 

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