Jump to content

Full screen GUI and resizing questions


DjSt3rios

Recommended Posts

Hello everyone. I am using dxGui and I create window, and I made it full screen by getting the screen resolution and making it a little bit bigger. I would like to ask you something, If someone has a smaller resolution, the GUI would have to become smaller. the problem now is, the buttons/images will stay big and it will not be shown properly. Do you think it would be possible to fix this problem? I was thinking to compare the original resolution i made it with with the current the user uses, and then somehow resize them or/and move them. What's your opinion about this?

Link to comment
Hello everyone. I am using dxGui and I create window, and I made it full screen by getting the screen resolution and making it a little bit bigger. I would like to ask you something, If someone has a smaller resolution, the GUI would have to become smaller. the problem now is, the buttons/images will stay big and it will not be shown properly. Do you think it would be possible to fix this problem? I was thinking to compare the original resolution i made it with with the current the user uses, and then somehow resize them or/and move them. What's your opinion about this?

I have been looking for age's for an answer for this, but i am yet to find anything. Maybe a Pro GUI'er will be able to help!

Link to comment
Hello everyone. I am using dxGui and I create window, and I made it full screen by getting the screen resolution and making it a little bit bigger. I would like to ask you something, If someone has a smaller resolution, the GUI would have to become smaller. the problem now is, the buttons/images will stay big and it will not be shown properly. Do you think it would be possible to fix this problem? I was thinking to compare the original resolution i made it with with the current the user uses, and then somehow resize them or/and move them. What's your opinion about this?

I have been looking for age's for an answer for this, but i am yet to find anything. Maybe a Pro GUI'er will be able to help!

Actually I think I found my solution. Although it might not fit perfect, but it looks pretty good so far. I just find the difference in percentage by dividing the new resolution with the old (1920 as x and 1080 as y, the one i originally made it and set it up), and then i get all the elements, their size and their position and i multiply it by the percentage (eg 0.50 for half size and position).

If you want I can give you some of my code, although it might need some changes, because its kinda a mess right now, I just managed to make it work alright :P

Link to comment
Hello everyone. I am using dxGui and I create window, and I made it full screen by getting the screen resolution and making it a little bit bigger. I would like to ask you something, If someone has a smaller resolution, the GUI would have to become smaller. the problem now is, the buttons/images will stay big and it will not be shown properly. Do you think it would be possible to fix this problem? I was thinking to compare the original resolution i made it with with the current the user uses, and then somehow resize them or/and move them. What's your opinion about this?

I have been looking for age's for an answer for this, but i am yet to find anything. Maybe a Pro GUI'er will be able to help!

Actually I think I found my solution. Although it might not fit perfect, but it looks pretty good so far. I just find the difference in percentage by dividing the new resolution with the old (1920 as x and 1080 as y, the one i originally made it and set it up), and then i get all the elements, their size and their position and i multiply it by the percentage (eg 0.50 for half size and position).

If you want I can give you some of my code, although it might need some changes, because its kinda a mess right now, I just managed to make it work alright :P

I'd gladly take some of your code! This has been bugging me for ages!

Link to comment

Alright, but as I said you might have to make changes to make it work.

Well here is some piece of code:

g = exports.dxGUI 
window = g:dxCreateWindow(getThisResource(),-1,-20,1922,1100,"test", white, default, g:dxGetDefaultTheme()) 
but = g:dxCreateButton(getThisResource(),160,90,300,80, "test", window) 
fresx = 1920 
fresy = 1080 
sresx = 1024 
sresy = 768 
[code] 
Now this will create a window in 1922 x 1100 (to make it full screen, outside of the screen) 
Now you will  need to get the users GUI screen size, i haven't cioded that but I guess you can make it. 
Then you will do something like that: 
  
[code]g:dxSetSize(window, sresx+2,sresy+20) 
        g:dxSetPosition(window, -1,-20) 
        local elements = getElementChildren(window)  -- the child elements 
        for k,v in ipairs(elements) do 
            width,height = g:dxGetSize(v) 
            g:dxSetSize(v, width*(sresx/fresx), height*(sresy/fresy)) 
            x,y = g:dxGetPosition(v) 
            g:dxSetPosition(v, x*(sresx/fresx), y*(sresy/fresy)) 
        end 

if you don't use dxGui you will have to make some changes to the functions too. Also one more note, if the user has a bigger screen resolution, where it says sresx/fresx it should be like fresx/sresx (well smaller number goes first.)

If you have any other problems with this let me know. I hope I helped.

Link to comment
Alright, but as I said you might have to make changes to make it work.

Well here is some piece of code:

g = exports.dxGUI 
window = g:dxCreateWindow(getThisResource(),-1,-20,1922,1100,"test", white, default, g:dxGetDefaultTheme()) 
but = g:dxCreateButton(getThisResource(),160,90,300,80, "test", window) 
fresx = 1920 
fresy = 1080 
sresx = 1024 
sresy = 768 
[code] 
Now this will create a window in 1922 x 1100 (to make it full screen, outside of the screen) 
Now you will  need to get the users GUI screen size, i haven't cioded that but I guess you can make it. 
Then you will do something like that: 
  
[code]g:dxSetSize(window, sresx+2,sresy+20) 
        g:dxSetPosition(window, -1,-20) 
        local elements = getElementChildren(window)  -- the child elements 
        for k,v in ipairs(elements) do 
            width,height = g:dxGetSize(v) 
            g:dxSetSize(v, width*(sresx/fresx), height*(sresy/fresy)) 
            x,y = g:dxGetPosition(v) 
            g:dxSetPosition(v, x*(sresx/fresx), y*(sresy/fresy)) 
        end 

if you don't use dxGui you will have to make some changes to the functions too. Also one more note, if the user has a bigger screen resolution, where it says sresx/fresx it should be like fresx/sresx (well smaller number goes first.)

If you have any other problems with this let me know. I hope I helped.

Thank you very much! I will definately work at this and inform you!

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