• HUD Alignment for resolution
    10 replies, posted
Alright, so I made my first HUD, and even tho I'm using precentage according to my current res (1920x1080) It still doesn't work on other resolutions, I've looked for a solution, but still not working for me. Any help? HUD in 1920x1080 - [url]http://imgur.com/jCJy8YQ[/url] HUD in 1600x900 - [url]http://imgur.com/aujzEHj[/url] [CODE] draw.Circle( ScrW() * 0.052, ScrH() * 0.905, 80, 80 ) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.847, 300, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.87, 325, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.893, 325, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.916, 325, 20, Color(36, 36, 36, 200))[/CODE]
When you change resolution - you have to restart gmod in order for values to update.
[QUOTE=WhiskerNip;49738596]Alright, so I made my first HUD, and even tho I'm using precentage according to my current res (1920x1080) It still doesn't work on other resolutions, I've looked for a solution, but still not working for me. Any help? HUD in 1920x1080 - [url]http://imgur.com/jCJy8YQ[/url] HUD in 1600x900 - [url]http://imgur.com/aujzEHj[/url] [CODE] draw.Circle( ScrW() * 0.052, ScrH() * 0.905, 80, 80 ) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.847, 300, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.87, 325, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.893, 325, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.916, 325, 20, Color(36, 36, 36, 200))[/CODE][/QUOTE] Try to use ScrW() for the X and leave a number value for the Y instead of using ScrH() ?
[QUOTE=Netheous;49739008]When you change resolution - you have to restart gmod in order for values to update.[/QUOTE] Alright, so it should work after I restart Gmod? Will try it and report back. [editline]14th February 2016[/editline] Alright, tested it out, theoretically it works, but any way to fix it not aligning the same way when using 1920x1080? Current result - [url]http://imgur.com/tEViOPk[/url]
[QUOTE=WhiskerNip;49739072]Alright, so it should work after I restart Gmod? Will try it and report back. [editline]14th February 2016[/editline] Alright, tested it out, theoretically it works, but any way to fix it not aligning the same way when using 1920x1080? Current result - [url]http://imgur.com/tEViOPk[/url][/QUOTE] I do use static X values in my own HUD and it scales correctly on all resolutions
[QUOTE=Deepnox;49739153]I do use static X values in my own HUD and it scales correctly on all resolutions[/QUOTE] Tried that, the HUD is under the screen, using static values doesn't make much sense. Static X works fine, gonna try using Static X and ScrH() for Y
[QUOTE=WhiskerNip;49739247]Tried that, the HUD is under the screen, using static values doesn't make much sense. Static X works fine, gonna try using Static X and ScrH() for Y[/QUOTE] Are you scaling the text also? Seems like that maybe your issues. Using static values wont solve your problem
[QUOTE=Roag15;49739258]Are you scaling the text also? Seems like that maybe your issues. Using static values wont solve your problem[/QUOTE] Major issue right now is the fact that the RoundedBoxes don't align(armor overlaping health, no gaps) Text is being scaled with [CODE]ScrW() * 0.095, ScrH () * 0.942,[/CODE]
[QUOTE=WhiskerNip;49739275]Major issue right now is the fact that the RoundedBoxes don't align(armor overlaping health, no gaps) Text is being scaled with [CODE]ScrW() * 0.095, ScrH () * 0.942,[/CODE][/QUOTE] You're changing the position based on screen resolution but not the height of the boxes, so them touching on smaller resolutions is expected. You either need to scale the height of the boxes too or set the positions like this: [code] draw.Circle( ScrW() * 0.052, ScrH() * 0.905, 80, 80 ) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.847, 300, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.847+30, 325, 20, Color(36, 36, 36, 200)) [/code] ect
[QUOTE=WhiskerNip;49739247]Tried that, the HUD is under the screen, using static values doesn't make much sense. Static X works fine, gonna try using Static X and ScrH() for Y[/QUOTE] Yeah that's what i'm talking about, static X and ScrH works well for me under any resolutions even after restarting my client
[QUOTE=Coffeee;49739298]You're changing the position based on screen resolution but not the height of the boxes, so them touching on smaller resolutions is expected. You either need to scale the height of the boxes too or set the positions like this: [code] draw.Circle( ScrW() * 0.052, ScrH() * 0.905, 80, 80 ) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.847, 300, 20, Color(36, 36, 36, 200)) draw.RoundedBox(8, ScrW() * 0.067, ScrH () * 0.847+30, 325, 20, Color(36, 36, 36, 200)) [/code] ect[/QUOTE] Editing using your suggested method and seems to be working, I'll report when I've edited all of the values using that.
Sorry, you need to Log In to post a reply to this thread.