Jump to content

Widescreens


SpecT

Recommended Posts

Posted

Hey guys! I have problem with a script which shows the real time. So i made it with dxDrawText. So i setted the position (my resolution 1920x1080). The problem is that my friend see it misplaced (he uses 1440x900). My question is how can i make it for all resolutions (including the widescreens) .

Here is my code:

function time() 
    local sx,sy = guiGetScreenSize() 
    local mix, miy = 1366, 768 
    local hours = getRealTime().hour 
    local minutes = getRealTime().minute 
     
        dxDrawText(string.format("%02d:%02d", hours, minutes), (101.7/mix)*sx, (540.7/miy)*sy, (1299/mix)*sx, (56/miy)*sy ,tocolor(0,0,0,255),0.7,"bankgothic","left","top",false,false,false) 
        dxDrawText(string.format("%02d:%02d", hours, minutes), (101/mix)*sx, (540/miy)*sy, (1299/mix)*sx, (56/miy)*sy ,tocolor(69,103,137,255),0.7,"bankgothic","left","top",false,false,false) 
  
        if (minutes < 10) then m = "0"..minutes end 
end 
addEventHandler ( "onClientRender", getRootElement(), time ) 

Posted

well that should be in the same spot ( you used relativ calculation ) , the problem would be or the text size ( i doubt that it move's very much the text but it could move it a bit).

My best guest is the display aspect ration , you mabe use 16:9 and your friend 4:3 or other one. Try to use

" dxSetAspectRatioAdjustmentEnabled "

Posted

If its about Text, make everything depend on the font height and text width.

There are function to get those values.

Anything else should depend on the height of the screen resolution.

Posted
well that should be in the same spot ( you used relativ calculation ) , the problem would be or the text size ( i doubt that it move's very much the text but it could move it a bit).

My best guest is the display aspect ration , you mabe use 16:9 and your friend 4:3 or other one. Try to use

" dxSetAspectRatioAdjustmentEnabled "

Doesn't work.

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