Jump to content

Question


Recommended Posts

To get it into the center, this is the equation:

local rx, ry = guiGetScreenSize ( ) 
window = guiCreateWindow ( ( rx / 2 - 500 / 2 ), ( ry / 2 - 250 / 2 ), 500, 250, "My Window", false ) 
-- Basicly this: divid rx by two, then subtract the width divided by two 
-- divid ry by two, then subtract the height by two 

Link to comment

Use some calculations, like the wiki said(copy of a post a mine):

https://wiki.multitheftauto.com/wiki/GuiGetScreenSize There are some calculations there

2. Divide each of the DX text's position values by the screen size manually (remembering the resolution is 1024x768):

Left position value is 684, 684/1024 = 0.668

Top position value is 731, 731/768 = 0.952

Right position values is 732, 732/1024 = 0.715

Bottom position value is 766, 766/768 = 0.997

You may want to use a calculator to help you count.

3. Now with the answer above remove all of the position values and replace it with the width or height variable multiplied by the answer. Which would be:

local sWidth,sHeight = guiGetScreenSize() -- The variables 
dxDrawText("Hello World!",sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) 

----------------------------------------------------------------------------

----------------------------MY EXAMPLE----------------------------------

----------------------------------------------------------------------------

So if you look at "2."

then you need to calculate it like this:

calc1 = Left position value / my local screenx = answer for all screen for next calculation screenX

calc2 = Top position value / my local screeny = answer for all screen for next calculation screenY

calc3 = Right position value/ my local screenx = answer for all screen for next calculation width

calc4 = Bottom position value/ my local screeny = answer for all screen for next calculation height

So after that you can use it like this:

local sX,sY = guiGetScreenSize()

sX*calc1, sY*calc2, sX*calc3, sY*calc4

This will be on all the resolutions the same.

I hope that I helped you.

Kindly regards,

Danny

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