Jump to content

How to make Dx fit on all screens?

Recommended Posts

With texts it will work for sure, but i suggest using allign arguments(it makes things easier) and you should make font's scale also calculated for resolution e.g

local scaleX,scaleY = 1/1920*sw, 1/1080*sh -- but can slightly decrease font quality because size usually ends up being a decimal number 

and rectangles, you need to use some calculations depending how big rectangle is


-- makes rectangle on middle of screen 
local sw,sh = guiGetScreenSize(); 
local rectangleWidth,rectangleHeight = 500/1920*sw, 180/1080*sh; 
local rectangleX,rectangleY = sw/2 - rectangleWidth/2, sh/2 - rectangleHeight/2; 
function draw() 

Link to comment

You can do it like this

(Copied from my script)

local sx,sy = guiGetScreenSize() 
local px,py = 1152,864 -- your resolution 
local x,y =  (sx/px), (sy/py) 

Edited by Guest
Link to comment
John Smith will that place all Dx Rect all in the middle?

Because I have Dx Rect in different areas, there is one way which I hate the most and is long, I thought there could be something easier.

This is easy man, just practice it a bit.

it works for infinite number of rectangles(if your calculation is right)

try out the script, change numbers and learn from it. (I have done that 29321013 times when learning how to script, and learned many things)

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