delta-client icon indicating copy to clipboard operation
delta-client copied to clipboard

Hide GUI in spectator mode and implement GUI toggling shortcut (F1)

Open stackotter opened this issue 2 years ago • 5 comments

These features are both relatively small and interlinked so I have lumped them into a single issue. Currently the hotbar is rendered in every gamemode, but it definitely shouldn't be in spectator mode.

The gamemode check for GUI rendering should go in the update method of GUI in GUI.swift. None of the code should run when the player is in a gamemode that doesn't render GUI. Add a noGUI property to the Gamemode struct that only returns true in spectator mode and then use that in the check just so that it's a bit more generic (maybe plugins will eventually be able to add custom gamemodes). Technically the crosshair shows up while in spectator mode when the player is looking at an entity and is close enough to interact with it (jump to its camera), however this is not required yet if you don't feel up to that, just add a // TODO: comments for someone to come back to later.

To implement GUI toggling you can add a boolean isVisible property to GUIState and then also use that in update along with gamemode.noGUI. You can then add a toggleGUI input to the Input enum (in Input.swift). Then you can add a default key binding in the Keymap struct (use f1 like vanilla does). Then you can add a case to the switch statement in the update method of the PlayerInputSystem struct to handle the toggleGUI input. You will then be able to test out the new shortcut (given that you will already have a Delta Client config file from before you added the keyboard shortcut, you will not get the default keybind and you will need to bind it manually, but for new users the default will be used).

That walkthrough should hopefully give you a pretty good start, but if you get stuck feel free to join the Discord server and ask for help. There are quite a few contributors there (including me) who'll be more than happy to give you a hand 🙂

stackotter avatar Oct 09 '22 01:10 stackotter

Hey @stackotter Can I work on this ?

chinmaym07 avatar Oct 09 '22 07:10 chinmaym07

Yep definitely! Let me know if you need any help at any point

stackotter avatar Oct 09 '22 07:10 stackotter

Hey, just checking whether you’re still planning on doing this issue or not so that I can free it up for someone else to try if you’ve changed your mind. All good if you just haven’t had the time yet, no rush at all

stackotter avatar Oct 13 '22 00:10 stackotter

Hey Hi @stackotter . Yes I am interested on working on this issue. Sorry for the delay here. I hope to complete this issue by this week.

chinmaym07 avatar Oct 16 '22 19:10 chinmaym07

Hi, that’s perfectly ok :)

stackotter avatar Oct 16 '22 21:10 stackotter

Hi @chinmaym07 any updates? I'm happy to keep you assigned if you still want to do it eventually (but it's not Hacktoberfest anymore so I'm guessing you won't)

stackotter avatar Nov 10 '22 12:11 stackotter

Done

stackotter avatar Aug 15 '23 02:08 stackotter