jawwel

Dx Gui Help

Recommended Posts

Hello everyone can someone help me set the gui to all resolution it only works on one

 

screenW, screenH = guiGetScreenSize()
resW, resH = 1366, 768
sW, sH = (screenW/resW), (screenH/resH)

example:

            dxDrawRectangle(0*sW, (i*45)-ground.scroll*sH, 43*sW, 43*sH, tocolor(255, 255, 255, 230))
            dxDrawImage(0*sW, (i*45)-ground.scroll*sH, 43*sW, 43*sH, "Imagenes/Inventario/Iconos/"..v[2]..".png", 0, 0, 0, tocolor(255, 255, 255))
            dxDrawRectangle(43*sW, (i*45)-ground.scroll*sH, 196*sW, 43*sH, tocolor(255, 255, 255, 200))
            dxDrawLine(0*sW, (i*45+42)-ground.scroll*sH, 513*sW, (i*45+42)-ground.scroll*sH, tocolor(255, 255, 255, 230), 2, false)
            dxDrawText(translateLocalization(v[2]), 48*sW, (i*45)-ground.scroll*sH, 194*sW, (i*45+45)-ground.scroll*sH, tocolor(255, 255, 255), 1, "default", "left", "center", false, false, false, false, false, 0, 0, 0);

 

Share this post


Link to post
sw, sh = guiGetScreenSize()
sx, sy = sw/1366, sh/768

function drawStuff()
    dxDrawRectangle(0*sx, (i*45)-ground.scroll*sy,43*sx, 43*sy, tocolor(255, 255, 255, 230))
	dxDrawImage(0*sx, (i*45)-ground.scroll*sy, 43*sx, 43*sy, "Imagenes/Inventarior/Iconos/"..v[2]..".png", sx*0, sy*0, sx*0, tocolor(255, 255, 255))
	dxDrawRectangle(43*sx, (i*45)-ground.scroll*sy, 196*sx, 43*sy, tocolor(255, 255, 255, 200))
	dxDrawLine(0*sx, (i*45+42)-ground.scroll*sy, 513*sx, (i*45+42)-ground.scroll*sy, tocolor(255, 255, 255, 230), sx*2, false)
	dxDrawText(translateLocalization(v[2]), 48*sx, (i*45)-ground.scroll*sy, 194*sx, (i*45+45)-ground.scroll*sy, tocolor(255, 255, 255), sx*1, "default", "left", "center", false, false, false. false, false, sx*0, sy*0, sx*0)
end
addEventHandler("onClientRender", root, drawStuff)

try this

Edited by Dimos7

Share this post


Link to post

it only works fine for sw/1366, sh/768 

other resolution still dont see it

Share this post


Link to post
local sx,sy = guiGetScreenSize()
local sw,sh = 1366,768

function toRelative(x,y,w,h)
	return x/sw*sx,y/sh*sy,w/sw*sx,h/sh*sy
end

local x,y,w,h = toRelative(400,500,200,300)-- use absolute values here.

 

Share this post


Link to post

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.