jawwel Posted April 4, 2018 Share Posted April 4, 2018 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); Link to comment
Dimos7 Posted April 4, 2018 Share Posted April 4, 2018 (edited) 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 April 4, 2018 by Dimos7 Link to comment
jawwel Posted April 4, 2018 Author Share Posted April 4, 2018 it only works fine for sw/1366, sh/768 other resolution still dont see it Link to comment
ShayF Posted April 5, 2018 Share Posted April 5, 2018 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now