Jump to content

help with dx functions


MAB

Recommended Posts

i made a speedometer and i used the guiGetScreenSize example way to make it fixed for all screen resolutions (this way was recommanded by many scripters in this forum in other topic by me about making dx elements visible for all screen resolutions) but when i ran the script in the server down this post some players said that it is small and others said that it is big and almost in the center of the screen but it is perfect with me of course . so anyone knows another/better way to make the dx elements fixed for all screen resolutions? please share fast with examples

Link to comment

this is wrong?

local sx,sy = guiGetScreenSize () 
local x,y = (sx/1280),(sy/768) 
dxDrawImage(x*992, y*653, x*25, y*29, ":speed/images/e.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
       dxDrawRectangle(x*992, y*536, x*185, y*29, tocolor(0, 0, 0, 100), false) 
       dxDrawRectangle(x*992, y*536, x*(currenthealth*1.85), y*29, color, false) 
       dxDrawRectangle(x*992, y*575, x*185, y*29, tocolor(0, 0, 0, 100), false) 
       dxDrawRectangle(x*992, y*575, x*(fuel*1.85), y*29, tocolor(0, 255, 255, 100), false) 
       dxDrawImage(x*992, y*576, x*24, y*28, ":speed/images/f.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
       dxDrawRectangle(x*992, y*497, x*185, y*29, tocolor(0, 0, 0, 100), false) -- speed 
       dxDrawRectangle(x*992, y*497, x*(kphSpeed/1.85*1.42), y*29, tocolor(163, 109, 4, 100), false) 
       dxDrawText(tostring(kphSpeed).."KM/H", x*1056, y*504, x*1100, y*518, tocolor(255, 255, 255, 255), x*0.50, "bankgothic", "left", "top", false, false, false, false, false) 
       dxDrawText(tostring(currenthealth).."%", x*1056, y*541, x*1100, y*555, tocolor(255, 255, 255, 255), x*0.50, "bankgothic", "left", "top", false, false, false, false, false) 
       dxDrawText(tostring(fuel).."%", x*1056, y*580, x*1095, y*600, tocolor(255, 255, 255, 255), x*0.50, "bankgothic", "left", "top", false, false, false, false, false) 
  

Link to comment
I suggest that you use the gui editor to draw the elements and then right click the element and then set relative,i've created multiple dx scripts thx to the gui editor it doesnt take that much and they all look the Same on size on every resolution

._. isn't that what it did up there?!

Link to comment
  • Moderators

I scale down like this.

local scaleFactor = math.min(guiGetScreenSize ())/1080 

My resolution is 1920x1080. So when you are making your dx stuff on your screen, replace 1080 with your screen height*.

* probably your screen height, I don't think people (can)play with 1080x1920.

Also sometimes you must limit the scaleFactor when you are working with text functions. When text get too small, people can't read it any more.

For example:

local scaleFactorText = scaleFactor 
if scaleFactorText < 0.3 then 
   scaleFactorText = 0.3 
end 

Link to comment
I scale down like this.
local scaleFactor = math.min(guiGetScreenSize ())/1080 

My resolution is 1920x1080. So when you are making your dx stuff on your screen, replace 1080 with your screen height*.

* probably your screen height, I don't think people (can)play with 1080x1920.

Also sometimes you must limit the scaleFactor when you are working with text functions. When text get too small, people can't read it any more.

For example:

local scaleFactorText = scaleFactor 
if scaleFactorText < 0.3 then 
   scaleFactorText = 0.3 
end 

mm..

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