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

Remove Buttons from Main Menu with Arcade Feature or WASM32 Target #186

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cdsupina
Copy link
Contributor

@cdsupina cdsupina commented Apr 24, 2024

We don't want users to be able to quit the game from the main menu when it is running on an arcade machine. Removed all other buttons besides the Play Game button for the arcade build. Fixes #180

@cdsupina cdsupina added the arcade Relating to the build of the game for arcade machines label Apr 24, 2024
Comment on lines 95 to 99
let buttons = if cfg!(feature = "arcade") {
vec![MainMenuButtonActionComponent::EnterInstructions]
} else {
Vec::from(MAIN_MENU_BUTTON_ORDER)
};
Copy link
Contributor

@varoonp123 varoonp123 Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im busy this week, so ill test this over the weekend. But I think this might not be right. To know the currently selected button when you press up/down with the arrows/gamepad, we increment/decrement a counter whenever you press up/down and mod by MAIN_MENU_BUTTON_ORDER.len(). Then we index into MAIN_MENU_BUTTON_ORDER to determine the event to send/action to take. So this might lead to unexpected behavior (the Compendium button is still there, even though the UI doesnt show it. Remember that this ChildBuilder is just used to show what is happening in an internal Local<MainMenuUIState> (basically an integer). It isn't really the "button) .

So really you either

  1. Make this generic over the ActionEventEnum+ActionEventEnum handling system+array of values that correspond to those actions
  2. At compile time, set MAIN_MENU_BUTTON_ORDER to be a singleton array when we use the arcade feature
  3. Toggle different main menu setups by placing each implementation in its own plugin and enabling/disabling those plugins in UIPlugin::build, and even based in CLI parameters by making UIPlugin have a field like simplified_start_menu: bool or main_menu_kind: MainMenuKindEnum . Something like: rename MainMenuPlugin to StackedButtonsMainMenuImplPlugin and the main_menu module to stacked_buttons_main_menu . Then do something like the following in MainMenuPlugin::build
// It is important that exactly one of these branches is taken because the single plugin on each branch
// provides some way for the user to go from `AppStates::MainMenu` to `AppStates::Instructions` and 
// gets to assume that it "controls the world" as far as drawing on the screen goes, if and only if we are 
// in `AppStates::MainMenu`. This invariant cannot be easily expressed in a type system
if cfg!(feature=arcade)` // || self.simple_main_menu
{
    self.add_plugins(ArcadeSinglePressMainMenuImplPlugin);
}
else {
self.add_plugins(StackedButtonsMainMenuImplPlugin);

}

Basically, if all you can do is go to the instructions screen, I dont think you even need a button. Make the UI you actually want in the arcade and dispatch to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to do option 2. Once we have more content to put on the main menu, like high scores, I think it will warrants its own plugin.

@cdsupina
Copy link
Contributor Author

@LordDeatHunter pointed out that we should also disable the exit button with the wasm build

@cdsupina cdsupina changed the title Remove Buttons from Main Menu with Arcade Feature Remove Buttons from Main Menu with Arcade Feature or WASM32 Target Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arcade Relating to the build of the game for arcade machines
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Remove Exit Button from Main Menu for Arcade Build
2 participants