FlyingSpoon Posted January 29, 2017 Share Posted January 29, 2017 (edited) 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 January 29, 2017 by raysmta Link to comment
AlvarO Posted January 29, 2017 Share Posted January 29, 2017 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
FlyingSpoon Posted January 29, 2017 Author Share Posted January 29, 2017 (edited) Tried it, same problem. Edited January 29, 2017 by raysmta Link to comment
#STZ Posted January 29, 2017 Share Posted January 29, 2017 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
FlyingSpoon Posted January 29, 2017 Author Share Posted January 29, 2017 That was random, I am trying to get my DX to fit on all screens. Link to comment
Blast3r Posted January 29, 2017 Share Posted January 29, 2017 Putting your resolution to something lower and making an dx from a lower resolution helps a lot. Link to comment
Simple0x47 Posted January 29, 2017 Share Posted January 29, 2017 You should make custom values for different kind of screens, to make sure they show up like you want. 1 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