Ulysses

General => Developers Corner => Topic started by: Digital Spit on December 30, 2013, 06:51:04 PM

Title: Working on a HUD, ScrW() is not your friend
Post by: Digital Spit on December 30, 2013, 06:51:04 PM
So, I'm trying to create a hud I created a HUD but! the only problem is how it's spaced on different peoples screens... the height is the same among everyone's screens it's the width that I'm having a hard time understanding, someone mind helping me here?

Here is how everyone sees it:
(http://cloud-4.steampowered.com/ugc/505826534901482884/9ACFDBECFF137F9E9198C446A354E0BB7B46CF89/1024x768.resizedimage)

Here is how I see it:
(http://cloud-3.steampowered.com/ugc/885254803425953034/B120FDDB4D96DFB30A51CE897B9359DBC7896577/1024x768.resizedimage)

How can I make it appear the same on everyone's screen no matter if they are running full screen, window mode or the res they are on?
Title: Re: Working on a HUD, ScrW() is not your friend
Post by: JamminR on December 30, 2013, 07:20:13 PM
No exact memory off top of my head, however, the ulx motd, and XGUI, are both reasonably dynamic in where they start.
They grab the users original screen res, then do a multiplication to start at a certain percentage into the width of the screen (height too I think).
Then the code is smart enough I think to remain static if screen res is lower than a certain size.
Title: Re: Working on a HUD, ScrW() is not your friend
Post by: Megiddo on December 30, 2013, 07:27:40 PM
JamminR is correct, we base it off percentages. Percentages brings some unique problems as well, but was the simplest for our purposes.
Title: Re: Working on a HUD, ScrW() is not your friend
Post by: Digital Spit on December 30, 2013, 07:38:30 PM
So my best bet is to look at how the MOTD is drawn on the players screen and go from there?
Title: Re: Working on a HUD, ScrW() is not your friend
Post by: Megiddo on January 01, 2014, 12:00:10 PM
Why not share the code you're currently using to position it?
Title: Re: Working on a HUD, ScrW() is not your friend
Post by: LuaTenshi on January 01, 2014, 04:06:00 PM
Try adding some debug functions to your code to print the current coordinates of the hud as well as ScrW() and ScrH().
Title: Re: Working on a HUD, ScrW() is not your friend
Post by: Digital Spit on January 01, 2014, 10:59:02 PM
The problem has been fixed!