isa_Khamdan Posted August 7, 2013 Share Posted August 7, 2013 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
WASSIm. Posted August 7, 2013 Share Posted August 7, 2013 function drawMessage ( ) local screenWidth, screenHeight = guiGetScreenSize ( ) dxDrawText ( msg, screenWidth/2, screenHeight/2, screenWidth, screenHeight, tocolor ( 255, 99, 8, 255 ), 2.2, "arial" ) end Link to comment
Vector Posted August 7, 2013 Share Posted August 7, 2013 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
isa_Khamdan Posted August 7, 2013 Author Share Posted August 7, 2013 screen resoultion will not change while client is inside the game, so you can avoid calculating the size of the screen eachframe, 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
golanu21 Posted August 7, 2013 Share Posted August 7, 2013 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
isa_Khamdan Posted August 7, 2013 Author Share Posted August 7, 2013 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
denny199 Posted August 7, 2013 Share Posted August 7, 2013 https://community.multitheftauto.com/in ... ls&id=6859 If you really want to script it foryourself, then you should play arround with https://wiki.multitheftauto.com/wiki/DxGetTextWidth & https://wiki.multitheftauto.com/wiki/DxGetFontHeight Link to comment
golanu21 Posted August 7, 2013 Share Posted August 7, 2013 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 Link to comment
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