Jump to content

GUI in all resolutions


Laysiks

Recommended Posts

Well if you wanted to make a window appear in the centre of any resolution, let's assume the width of the window is 640, and the height is 480, and we have the variables resX and resY:

x = resX / 2 - (640 / 2)

y = resY / 2 - (480 / 2)

width = 640

height = 480

It's all about logic and maths, not something you can really copy and paste (unless you only ever want the windows in the middle).

Link to comment

I'll tell you a very simple way.

DX

  
local myResX, myResY = 1024, 768 -- This is my resolution. Relace it with yours ^^ 
local sx, sy = guiGetScreenSize  ( ) 
sx,sy = sx/ myResX, sy/myResY -- divide it by your resolution and so on you can easily scale  
dxDrawImage ( sx * 100, sy*100, sx*40, sy*40 ) -- RELATIVE SIZES. This will fit on all resolutions ;p 
  

GUI

  
-- For gui set the relative optional arguement to true 
local myResX, myResY = 1024, 768 -- This is my resolution. Relace it with yours ^^ 
  
guiCreateWindow ( 40/myResX, 30/myResY, 300/myResX , 600/myResY, "Relative sized window", 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...