Jump to content

Dxdraw Question


aintaro

Recommended Posts

Posted

Hello guys,

How would I write a simple dxdraw method where the font size is adjusted to the screen resolution?

I know dxdraw has a optional scaleX and scaleY as arguments for the method but I just don't know how to write it.

Thanks , aintaro

None of us is as smart as all of us.

Posted

You can get the screen width and hight with guiGetScreenSize.

You can then use something like

local screenWidth, screenHeight = guiGetScreenSize ( ) -- Get the screen resolution (width and height) 
  
local scale = screenHeight/10 
  
function createText ( ) 
    dxDrawText ("TEXT HERE",200,200,0, 0, tocolor ( 255, 255, 255, 255 ), scale, "pricedown" )  
end 
  
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) 
  

I aint got no time to think of a witty signature

Posted
For advanced scaling(how everyone uses it)
local sX,sY = guiGetScreenSize() 
local Scale = sY/900 -- 900 is your screen height(1600x900) 

Yeah thanks for letting me know, I did use it exactly like that

None of us is as smart as all of us.

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