Jump to content

Necesito una solucion para un dxdrawn


Eduardoh1997

Recommended Posts

Hola alguien no me ayudaria para obtener la resolucion en este client.

PD: es un simple dxDrawnRectangle pero quisiera saber que cualquier resoulucion acepte lo que hice.

local x,y = guiGetScreenSize()  
  
function DXdraw() 
        dxDrawRectangle ( 14, 570, 313, 180, tocolor ( 0, 0, 0, 150 ) ) 
end 
  
addEventHandler("onClientRender", root, DXdraw)  

Link to comment

Es sencillo, utilizas una multiplicación, por ejemplo si hubieses hecho este código en 1024x768 haces esto:

14 / 1024 = .013671875

570 / 768 = .7421875

313 / 1024 = .3056640625

180 / 768 = .234375

Entonces, luego de hacer esas divisiones, haces la operación contraria pero con las variables de tamaño:

local x,y = guiGetScreenSize() 
  
function DXdraw() 
        dxDrawRectangle ( x*.013671875, y*.7421875, x*.3056640625, y*.234375, tocolor ( 0, 0, 0, 150 ) ) 
end 
  
addEventHandler("onClientRender", root, DXdraw) 

y así debería funcionar bien en todas las resoluciones.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...