[Answered] BeginHUD() and BeginStatusBar()

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

[Answered] BeginHUD() and BeginStatusBar()

Postby Jekyll Grim Payne » Tue May 24, 2022 9:23 am

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.
Last edited by Jekyll Grim Payne on Tue Jun 07, 2022 2:24 pm, edited 1 time in total.
User avatar
Jekyll Grim Payne
 
 
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: BeginHUD() and BeginStatusBar()

Postby Ac!d » Tue May 24, 2022 1:07 pm

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)

Code: Select allExpand view
      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.
User avatar
Ac!d
Perfection is a way, not an end. - Korean Proverb
 
Joined: 02 Apr 2019
Location: France
Discord: Ac!d#2732
Operating System: Windows 10/8.1/8 32-bit

Re: BeginHUD() and BeginStatusBar()

Postby phantombeta » Tue May 24, 2022 1:22 pm

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.
User avatar
phantombeta
Tired of being treated like trash by control freaks
 
Joined: 02 May 2013

Re: BeginHUD() and BeginStatusBar()

Postby Jekyll Grim Payne » Thu May 26, 2022 12:15 pm

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.
User avatar
Jekyll Grim Payne
 
 
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: BeginHUD() and BeginStatusBar()

Postby Graf Zahl » Fri May 27, 2022 2:48 pm

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: BeginHUD() and BeginStatusBar()

Postby Jekyll Grim Payne » Sat May 28, 2022 3:09 am

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).
User avatar
Jekyll Grim Payne
 
 
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: BeginHUD() and BeginStatusBar()

Postby Jekyll Grim Payne » Tue Jun 07, 2022 6:46 am

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.
User avatar
Jekyll Grim Payne
 
 
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: BeginHUD() and BeginStatusBar()

Postby Exosphere » Tue Jun 07, 2022 9:40 am

Ac!d wrote:An example in pictures :
Spoiler: both screenshots are taken with default scale (StatusBar and FullScreen)


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.
User avatar
Exosphere
 
Joined: 11 Jun 2017
Location: New England, US

Re: BeginHUD() and BeginStatusBar()

Postby Jekyll Grim Payne » Tue Jun 07, 2022 1:01 pm

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 allExpand view
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.
User avatar
Jekyll Grim Payne
 
 
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests