MKH Posted February 8, 2017 Share Posted February 8, 2017 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 Link to comment
3aGl3 Posted February 8, 2017 Share Posted February 8, 2017 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 ) Link to comment
MKH Posted February 8, 2017 Author Share Posted February 8, 2017 and it will work fine for all resolutions ? Link to comment
3aGl3 Posted February 9, 2017 Share Posted February 9, 2017 Yes. 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now