Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Global to Hide/Show all HUD elements #2945

Open
FDinolfo opened this issue Feb 12, 2025 · 2 comments
Open

[Feature] Global to Hide/Show all HUD elements #2945

FDinolfo opened this issue Feb 12, 2025 · 2 comments

Comments

@FDinolfo
Copy link

FDinolfo commented Feb 12, 2025

GZDoom version

GZDoom 4.14.0

Which game are you running with GZDoom?

None

What Operating System are you using?

Windows 11

If Other OS, please describe

No response

Relevant hardware info

No response

Is your feature request related to a problem? Please describe.

We've just spent a good bit of time trying to come up with a way of hiding and restoring HUDs. It was pointed out that this probably should be made into a proper method, so I'm making the feature request for it.

The ZS for it is this, but obviously, if it's an internal method, it could be refined.

class HUDController : EventHandler
{
    bool hudhidden[MAXPLAYERS];
    ui Vector2 savedhudOffset[MAXPLAYERS];
    const HIDEHUDOFFSET = 9000;

    static void HideHUD(int playernumber)
    {
        if (playernumber >= MAXPLAYERS) return;
        let handler = HUDController(EventHandler.Find('HUDController'));
        if (handler)
        {
            handler.hudhidden[playernumber] = true;
        }
    }

    static void ShowHUD(int playernumber)
    {
        if (playernumber >= MAXPLAYERS) return;
        let handler = HUDController(EventHandler.Find('HUDController'));
        if (handler)
        {
            handler.hudhidden[playernumber] = false;
        }
    }

    override void UiTick()
    {
        if (hudhidden[consoleplayer] && statusbar.drawOffset.x != HIDEHUDOFFSET)
        {
            savedhudOffset[consoleplayer] = statusbar.drawOffset;

	    StatusBar.SetSize(0,0,0,0,0);
            statusbar.drawOffset = (HIDEHUDOFFSET, HIDEHUDOFFSET);
        }

        if (!hudhidden[consoleplayer] && statusbar.drawOffset.x == HIDEHUDOFFSET)
        {
            statusbar.drawOffset = savedhudOffset[consoleplayer];
            statusbar.Init();
        }
    }
}

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Add any other context or screenshots about the feature request here.

No response

@madame-rachelle
Copy link
Collaborator

Is the request for it to be mod accessible? Because there's already the togglehud command for taking screenshots.

@FDinolfo
Copy link
Author

Yes. So mods that don't make their own huds can hide it when making cutscenes. This works for now, at least, but a mod accessible method would be ideal. Didn't find any mention of togglehud on the wiki, so I'm assuming that's not externally accessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants