Jump to content

DX resoulution


villr

Recommended Posts

Hi there! I have a problem with my dx thing i made for resoulutions, i made it so it should be easier so dont have to count the math self on every dx element because the thing im making now is around 100 dx element, this is the code:

function fixSimsDXRes(r1,r2,r3,r4) 
 return sW*(r1/1360), sH*(r2/768), sW*(r3/1360), sH*(r4/768) 
end 
  

dxDrawRectangle(fixSimsDXRes(94, 677, 135, 28), tocolor(3, 20, 112, 255), true)  
dxDrawRectangle(fixSimsDXRes(0, 612, 94, 129), tocolor(3, 20, 112, 255), true)  
dxDrawRectangle(fixSimsDXRes(94, 612, 136, 29), tocolor(3, 20, 112, 255), true) 

The problem is, i dont know how to make it stop fixing the resoulution all time, because it goes on and the positions get wrong.

How can i fix this??

Link to comment
Yes but i have that, i see now that i just forgot to copy that to here.
local sW, sH = guiGetScreenSize() 
function fixSimsDXRes(r1,r2,r3,r4) 
 return sW*(r1/1360), sH*(r2/768), sW*(r3/1360), sH*(r4/768) 
end 

Try this

local sW, sH = guiGetScreenSize() 
function fixSimsDXRes(r1,r2,r3,r4) 
    return sW*(r1/1440), sH*(r2/900), sW*(r3/1440), sH*(r4/900) 
end 

Link to comment

That wont be right, because that wont fit my resoulution, the numbers of dividing is the numbers of my resulution.

But that dont work either, the problem is that it does the calculationg over and over again, try the code yourself and you will see what i mean, if you add debug you will see that the third argument will dissapear

Link to comment
Sorry, the pc im currently using can't run gtasa properly, so im telling you that if you want it to be fit ONLY for your resolution, then it won't be fit for other resolutions ... you should calculate it so it fits all resolutions.

Oh sorry, i see i typed wrong to u...

The code i made is taking that resoulution(1360x768) and then calculates new res based on the players res.

Edited by Guest
Link to comment
The problem is, i dont know how to make it stop fixing the resoulution all time, because it goes on and the positions get wrong.

How can i fix this??

Ok, why don't you define variables instead of a fixing function?, like this:

local sW, sH = guiGetScreenSize() 
local posX, posY, hX, wY = sW*(r1/1360), sH*(r2/768), sW*(r3/1360), sH*(r4/768) 

Link to comment

Try this:

local x, y = guiGetScreenSize() 
dxDrawRectangle(fixSimsDXRes(x*(94.0/1360), y*(677.0/768), x*(135.0/1360), y*(28.0/768), tocolor(3, 20, 112, 255), true) 
dxDrawRectangle(fixSimsDXRes(x*(0.0/1360), y*(612.0/768),x*(94.0/1360), y*(129.0/768), tocolor(3, 20, 112, 255), true) 
dxDrawRectangle(fixSimsDXRes(x*(94.0/1360), y*(612.0, x*(136.0/1360),y*(29.0/768), tocolor(3, 20, 112, 255), true) 

Link to comment

OH, lol sorry, i forgot to remove it, try this:

local x, y = guiGetScreenSize() 
dxDrawRectangle(x*(94.0/1360), y*(677.0/768), x*(135.0/1360), y*(28.0/768), tocolor(3, 20, 112, 255), true) 
dxDrawRectangle(x*(0.0/1360), y*(612.0/768),x*(94.0/1360), y*(129.0/768), tocolor(3, 20, 112, 255), true) 
dxDrawRectangle(x*(94.0/1360), y*(612.0/768), x*(136.0/1360),y*(29.0/768), tocolor(3, 20, 112, 255), true) 

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...