Sign in to follow this  

Dx help

Recommended Posts

Hello, i just wanna to know, first i made a simple dx gui, my resolution was 1366x786 i think, and my friend's resolution was 1600x900, the gui if looking fine for me because i made it, but its not fine for my friends, i just wanna to know how to draw dx for all resolutions

Share this post

Link to post

You will have to get the screens size with something like this:

screenW, screenH = guiGetScreenSize()

After that you can offset everything from that, for example to place something on the right side of the screen:

local width = 128
local height = 32
local x = screenW - width - 10			-- 10 so it has some space to the right
local y = 50

dxDrawRectangle( x, y, width, height )


Share this post

Link to post


The function guiGetScreenSize will return the players game resolution, thus screenW will be the width of his screen (window if he plays in windowed mode).
So all you have to di is decide which elements should snap to the right of the screen and which to the left. Of course you can also use screenH to make something align with the bottom of the screen in a similar fashion.

Share this post

Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.