Jump to content

Dx resolution


Best-Killer

Recommended Posts

local screenW, screenH = guiGetScreenSize()
local sx, sy = (screenW/1280), (screenH/768)   

function jobwindow()
if isMouseSetColor (sx*505, sy*519, sx*76, sy*37) then coloracc = tocolor(0, 153, 0, 255) end
if isMouseSetColor (sx*710, sy*519, sx*76, sy*37) then colordec = tocolor(255, 0, 0, 255) end
dxSetAspectRatioAdjustmentEnabled( true )
dxDrawImage(sx*357, sy*161, sx*550, sy*450, imagepath, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("Accept", 505*sx, 519*sy, 76*sy, 37*sx, coloracc, 1.00*sx, newFont, "left", "top", false, false, false, false, false)
dxDrawRectangle(sx*505, sy*519, sx*76, sy*37, tocolor(0, 0, 0, 0), false)
dxDrawText("decline", sx*710, sy*519, sx*76, sy*37, colordec, 1.00*sx, newFont, "left", "top", false, false, false, false, false)
dxDrawRectangle(sx*710, sy*519, sx*76, sy*37, tocolor(0, 0, 0, 0), false)
coloracc = tocolor(255, 255, 255, 255)
colordec = tocolor(255, 255, 255, 255)
end

the things for me fine but my freind have  resolution 1920x1080 the text is not showing for him what is the problem ?? i can fix ? or players can't play with resolution  1920x1080

Link to comment

It's all about the calculate this is an example to do it for all resolutions :

 

dxDrawText("Accept", screenW*505/1280, screenH*519/768, screenW*76/1280, screenH*37/768, coloracc,screenH / 768 * 1.00 , newFont, "left", "top", false, false, false, false, false)

 

Try this if it's working do it for all dx you are drawing.

@Best-Killer

Edited by iPrestege
typo
Link to comment


function jobwindow()
if isMouseSetColor (sx*505, sy*519, sx*76, sy*37) then coloracc = tocolor(0, 153, 0, 255) end
if isMouseSetColor (sx*710, sy*519, sx*76, sy*37) then colordec = tocolor(255, 0, 0, 255) end
dxSetAspectRatioAdjustmentEnabled( true )
dxDrawImage(sx*357, sy*161, sx*550, sy*450, imagepath, 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("Accept", screenW*505/1280, screenH*519/768, screenW*76/1280, screenH*37/768, coloracc,screenH / 768 * 1.00 , newFont, "left", "top", false, false, false, false, false)

dxDrawRectangle(sx*505, sy*519, sx*76, sy*37, tocolor(0, 0, 0, 0), false)
dxDrawText("decline", sx*710, sy*519, sx*76, sy*37, colordec, 1.00*sx, newFont, "left", "top", false, false, false, false, false)
dxDrawRectangle(sx*710, sy*519, sx*76, sy*37, tocolor(0, 0, 0, 0), false)
coloracc = tocolor(255, 255, 255, 255)
colordec = tocolor(255, 255, 255, 255)
end

i just add your code dude :v 

Errors : No

me or my friend : i can see the texts but my friend no

Link to comment

guys i tried with 2 ways : 

 

1-

local sWidth,sHeight = guiGetScreenSize()
dxDrawText("accept",(505/1280)*sWidth, (519/768)*sHeight, (76/1280)*sWidth, (37/768)*sHeight, coloracc, (1280/sWidth)*1.00, newFont,"left","top",false,false,false) 

2-

 screenWidth, screenHeight = guiGetScreenSize() 
  scaleX = screenWidth/1280 
  scaleY = screenHeight/768 

dxDrawText( "Accept" ,505*scaleX, 519*scaleY, 76*scaleX, 37*scaleY, coloracc, scaleX*1.00, newFont,"left","top",false,false,false)

and same problem dude :v any help ?

Note : 0 errors 

Link to comment

Try this, I can't really test but this is the way I make all my dxDrawText show ok on any screen.

local x, y = guiGetScreenSize()
local sx, sy = x/1440, y/900

local coloracc
local colordec

function jobwindow()
	if isMouseSetColor (x*0.26302083, y*0.48056, x*0.039583, y*0.03425926) then
		coloracc = tocolor(0, 153, 0, 255)
	end
	
	if isMouseSetColor (x*0.36979167, y*0.48056, x*0.039583, y*0.03425926) then
		colordec = tocolor(255, 0, 0, 255)
	end
	
	dxSetAspectRatioAdjustmentEnabled(true)
	
	dxDrawImage(x*0.1859375, y*0.14907407, x*0.2864583, y*0.4167, imagepath, 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawText("Accept", x*0.26302083, y*0.48056, x*0.039583, y*0.03426, coloracc, 1*sy, newFont, "left", "top", false, false, false, false, false)
	dxDrawRectangle(x*0.26302083, y*0.48056, x*0.039583, y*0.03426, tocolor(0, 0, 0, 0), false)
	dxDrawText("Decline", x*0.36979167, y*0.48056, x*0.039583, y*0.03426, colordec, 1*sy, newFont, "left", "top", false, false, false, false, false)
	dxDrawRectangle(x*0.36979167, y*0.48056, x*0.039583, y*0.03426, tocolor(0, 0, 0, 0), false)
	
	coloracc = tocolor(255, 255, 255, 255)
	colordec = tocolor(255, 255, 255, 255)
end

EDIT: Your code can work too I think but you've made a mistake in the text size.

1.00*sx

should be

1.00*sy

in lines 9 and 11 of your first post's code.

Edited by koragg
Link to comment
7 hours ago, Best-Killer said:

about 1.00*sy you're right xD but your code not work and my not work too wtf  any pro dxdraw text help or any others help pls 

#koragg thx for your try bro

Make the positions of everything look ok for YOUR resolution only (just numbers, no multiplications). Then post your code and say on what resolution you've made it. I'll take a look then and try to fix it for any screen. 

 

Btw what's that "isMouseSetColor" thing? I can't find it on the wiki. 

Edited by koragg
Link to comment
On 20. 12. 2016 at 9:21 AM, koragg said:

Make the positions of everything look ok for YOUR resolution only (just numbers, no multiplications). Then post your code and say on what resolution you've made it. I'll take a look then and try to fix it for any screen. 

 

Btw what's that "isMouseSetColor" thing? I can't find it on the wiki. 

I think it's isMouseInPosition

Edited by 1LoL1
Link to comment

Try that, and change ( 1366, 768 ) to your screen resolution

local nW,nH = guiGetScreenSize()
local x, y = nW/1366,nH/768

addEventHandler("onClientRender",root,
	function ()
		dxDrawText("MTA Forum", x*680, y*464, x*811, y*490, tocolor(255, 255, 255, 255), 2, "default-bold", "center", "center", false, false, true, false, false)
	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...