Jump to content

MTA Fit Screen Resolutions


FlyingSpoon

Recommended Posts

I used GUIEditor, and set some images and DX to relative so it fits on others screens. But it appears very weird and distorted.

How can I make it so it fits on everyone's screen -

local screenW, screenH = guiGetScreenSize()


        dxDrawImage(screenW * 0.1727, screenH * 0.1833, screenW * 0.1953, screenH * 0.3472, "img1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.4047, screenH * 0.1833, screenW * 0.1953, screenH * 0.3472, "img2.png, 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.6414, screenH * 0.1833, screenW * 0.1953, screenH * 0.3472, "img3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.2898, screenH * 0.5306, screenW * 0.1953, screenH * 0.3472, "img4.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.5227, screenH * 0.5306, screenW * 0.1953, screenH * 0.3472, "img5.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

Edited by raysmta
Link to comment

It's easy, just use (valueinrelative/yourXsize)*screenW, (valueinrelative/yourYsize)* screenH  , (valueinrelative/yourXsize)*screenW, (valueinrelative/yourYsize)* screenH 

Little example:

[lua]

local sX, sY = guiGetScreenSize()

dxDrawImage((25/1920)*sX, (192/1080)*sY, (10/1920)*sX, (193/1080)*sY, "hello.png", 0, 0, 0, tocolor(255, 255, 255, 255, false)

[/lua]

Also don't forget to use "onClientRender"

Link to comment
function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing ( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

 

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