Page 1 of 1

[Answered] BeginHUD() and BeginStatusBar()

Posted: Tue May 24, 2022 9:23 am
by Jekyll Grim Payne
Can somebody explain the difference between these two functions and what their arguments actually do? They're not exposed to ZScript and not documented, so I can't quite tell what they do. I know it's not a requirement per se to use both; I've created a HUD that uses only BeginHUD() while still displaying different things in HUD_StatusBar and HUD_Fullscreen modes.

Some lightshedding would be appreciated.

Re: BeginHUD() and BeginStatusBar()

Posted: Tue May 24, 2022 1:07 pm
by Ac!d
I may be wrong, but :

BeginStatusBar(bool forceScaled = False, int resW = -1, int resH = -1, int rel = -1) is used the status bar, most importantly for the graphics IMO.

BeginHUD(double Alpha = 1., bool forcescaled = False, int resW = -1, int resH = -1) is used for anything which doesn't look like a status bar, or something "less limited" (Again, IMO)


An example in pictures :
[spoiler=both screenshots are taken with default scale (StatusBar and FullScreen)][imgur]https://i.imgur.com/ThCLTio[/imgur]
[imgur]https://i.imgur.com/DAmTqzy[/imgur][/spoiler]

Code: Select all

      override void Draw(int state, double TicFrac)
   {
      Super.Draw(state, TicFrac);
      // BeginStatusBar() // used for the first screenshot
      BeginHUD(); // used for the second screenshot
        if (!automapactive)
        {
         if(state == HUD_StatusBar)
         {
            DrawFullScreenStuff(); // I'm lazy. Blame me if you want...
         }
         else if(state == HUD_Fullscreen)
         {
            DrawFullScreenStuff();
         }
      }
   }


This is how I see the difference between these two functions.

Re: BeginHUD() and BeginStatusBar()

Posted: Tue May 24, 2022 1:22 pm
by phantombeta
Ac!d wrote:BeginStatusBar(bool forceScaled = False, int resW = -1, int resH = -1, int rel = -1) is used the status bar, most importantly for the graphics IMO.

BeginHUD(double Alpha = 1., bool forcescaled = False, int resW = -1, int resH = -1) is used for anything which doesn't look like a status bar, or something "less limited" (Again, IMO)

This is essentially correct. BeginStatusBar is designed for vanilla-style statusbars specifically, where it cuts off a bit of the bottom of the viewport and moves the weapon sprite up a bit, whereas BeginHUD is intended for everything else.

Re: BeginHUD() and BeginStatusBar()

Posted: Thu May 26, 2022 12:15 pm
by Jekyll Grim Payne
I understand the difference in intention, but what I need is a documentation. What are the default arguments? What do they do?
Moving the weapon sprite is one specific feature of BeginStatusBar, but I'd like to know what else is specific about it.

Re: BeginHUD() and BeginStatusBar()

Posted: Fri May 27, 2022 2:48 pm
by Graf Zahl
These set the virtual coordinate system for the statusbar or HUD. With a status bar you want your items placed in a bottom-center-aligned box, but with a HUD you want your stuff aligned with the screen's corners.

Re: BeginHUD() and BeginStatusBar()

Posted: Sat May 28, 2022 3:09 am
by Jekyll Grim Payne
Graf Zahl wrote:These set the virtual coordinate system for the statusbar or HUD. With a status bar you want your items placed in a bottom-center-aligned box, but with a HUD you want your stuff aligned with the screen's corners.


Again, it doesn't really answer my question about the default values for the arguments and the meaning of those argulemts (well, it's mostly clear except that rel argument in BeginStatusBar).

Re: BeginHUD() and BeginStatusBar()

Posted: Tue Jun 07, 2022 6:46 am
by Jekyll Grim Payne
Bump. Still looking to find what the default values for these are so I could document these functions in detail.
If somebody could point me to the source code for these functions, that'd work too.

Re: BeginHUD() and BeginStatusBar()

Posted: Tue Jun 07, 2022 9:40 am
by Exosphere
Ac!d wrote:An example in pictures :
[spoiler=both screenshots are taken with default scale (StatusBar and FullScreen)][imgur]https://i.imgur.com/ThCLTio[/imgur]
[imgur]https://i.imgur.com/DAmTqzy[/imgur][/spoiler]

This is how I see the difference between these two functions.


If you don't mind me asking, could you post the full code of this example HUD? It might help us in our understanding of how exactly all of this works.

Re: BeginHUD() and BeginStatusBar()

Posted: Tue Jun 07, 2022 1:01 pm
by Jekyll Grim Payne
Update: I still have zero clue how to use the arguments of BeginStatusBar(). It appears as if the function is not designed to even have them different from default values.

Code: Select all

void BeginStatusBar(bool forceScaled = false, int resW = -1, int resH = -1, int rel = -1)


Update 2: To summarize the answer I got from Graf in Discord: BeginStatusBar() defines its area as a box attached to a center bottom of the screen. It also disables fullscreenOffsets, so the drawing offsets are placed within that box. BeginHUD(), in contrast, draws relative to the screen corners by default, automatically adjusting for different aspecr atios.

The rel argument that was bothering me so much, doesn't do anything currently.