Jump to content

Little help needed :D


Recommended Posts

How can I make the dxDrawtext always in the center of the screen in all screen resolutions?

function drawMessage ( ) 
  
    local screenWidth, screenHeight = guiGetScreenSize ( ) 
  
    dxDrawText ( msg, 320, screenHeight - 320, screenWidth, screenHeight, tocolor ( 255, 99, 8, 255 ), 2.2, "arial" ) 
  
  
end  

Link to comment

screen resoultion will not change while client is inside the game, so you can avoid calculating the size of the screen each

frame, and calculate it just one time.

  
local screenWidth, screenHeight = guiGetScreenSize (); 
function drawMessage () 
    dxDrawText ( msg,  screenWidth/2, screenHeight/2, screenWidth, screenHeight, tocolor ( 255, 99, 8, 255 ), 2.2, "arial" ) 
end 
  

Link to comment
screen resoultion will not change while client is inside the game, so you can avoid calculating the size of the screen each

frame, and calculate it just one time.

  
local screenWidth, screenHeight = guiGetScreenSize (); 
function drawMessage () 
    dxDrawText ( msg,  screenWidth/2, screenHeight/2, screenWidth, screenHeight, tocolor ( 255, 99, 8, 255 ), 2.2, "arial" ) 
end 
  

I tested it but it didn't show in the center of the screen?

Link to comment
addEventHandler("onClientRender", root, 
    function() 
  
    local screenWidth, screenHeight = guiGetScreenSize ( ) 
  
    dxDrawText ( msg, 320, screenHeight - 320, screenWidth, screenHeight, tocolor ( 255, 99, 8, 255 ), 2.2, "arial" ) 
  
end ) 

Not tested

Link to comment
addEventHandler("onClientRender", root, 
    function() 
  
    local screenWidth, screenHeight = guiGetScreenSize ( ) 
  
    dxDrawText ( msg, 320, screenHeight - 320, screenWidth, screenHeight, tocolor ( 255, 99, 8, 255 ), 2.2, "arial" ) 
  
end ) 

Not tested

You didn't change anythings

Link to comment
  
local sWidth, sHeight = guiGetScreenSize (); 
addEventHandler("onClientRender", root, 
    function() 
msg = "text" 
dxDrawText(msg,sWidth/2, sHeight/2, sWidth, sHeight,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) 
end ) 

for me it's work :D

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