-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Conversation
src/ui/main_menu/button.rs
Outdated
let buttons = if cfg!(feature = "arcade") { | ||
vec![MainMenuButtonActionComponent::EnterInstructions] | ||
} else { | ||
Vec::from(MAIN_MENU_BUTTON_ORDER) | ||
}; |
There was a problem hiding this comment.
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
- Make this generic over the ActionEventEnum+ActionEventEnum handling system+array of values that correspond to those actions
- At compile time, set
MAIN_MENU_BUTTON_ORDER
to be a singleton array when we use the arcade feature - 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 makingUIPlugin
have a field likesimplified_start_menu: bool
ormain_menu_kind: MainMenuKindEnum
. Something like: renameMainMenuPlugin
toStackedButtonsMainMenuImplPlugin
and themain_menu
module tostacked_buttons_main_menu
. Then do something like the following inMainMenuPlugin::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.
There was a problem hiding this comment.
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.
@LordDeatHunter pointed out that we should also disable the exit button with the wasm build |
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