Don't allow quitting on the web
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f08691a62e
commit
c17013ac92
2 changed files with 13 additions and 5 deletions
|
@ -88,7 +88,9 @@ pub fn draw(resources: &Resources, bterm: &mut BTerm) {
|
|||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 19, "Whip");
|
||||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 20, "Teleport");
|
||||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 21, "Pause");
|
||||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 22, "Quit");
|
||||
if !cfg!(target_family = "wasm") {
|
||||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 22, "Quit");
|
||||
}
|
||||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 23, "Save");
|
||||
bterm.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 24, "Restore");
|
||||
|
||||
|
|
|
@ -71,10 +71,16 @@ pub fn handle(world: &mut World, resources: &mut Resources, bterm: &mut BTerm) {
|
|||
resources.show_debug_info = !resources.show_debug_info;
|
||||
}
|
||||
VirtualKeyCode::Escape | VirtualKeyCode::Q => {
|
||||
resources.flashing_message = Some(FlashingMessage::new(
|
||||
" Are you sure you want to quit (Y/N)? ",
|
||||
Some(FlashingMessageIntent::Quit),
|
||||
));
|
||||
if cfg!(not(target_family = "wasm")) {
|
||||
resources.flashing_message = Some(FlashingMessage::new(
|
||||
" Are you sure you want to quit (Y/N)? ",
|
||||
Some(FlashingMessageIntent::Quit),
|
||||
));
|
||||
} else if let (Some(sound_effects), Some(sound_output)) =
|
||||
(&mut resources.sound_effects, &mut resources.sound_output)
|
||||
{
|
||||
sound_output.play_sound(sound_effects.bad_key.clone());
|
||||
}
|
||||
}
|
||||
VirtualKeyCode::P => {
|
||||
if let (Some(sound_effects), Some(sound_output)) =
|
||||
|
|
Loading…
Add table
Reference in a new issue