add Camera to menu

This commit is contained in:
yuni 2024-05-13 23:51:18 +02:00
parent 9c148a5a7c
commit 60d3198e41

View file

@ -47,6 +47,7 @@ pub const MENUDEF: &[(&str, MenuAction)] = &[
("", MenuAction::ToggleAR),
("", MenuAction::ToggleSound),
("", MenuAction::ToggleMusic),
("", MenuAction::ToggleCamera),
("Toggle Fullscreen [F11]", MenuAction::ToggleFullscreen),
("", MenuAction::ToggleShadows),
("Restart Game", MenuAction::Restart),
@ -59,6 +60,7 @@ pub enum MenuAction {
ToggleAR,
ToggleSound,
ToggleMusic,
ToggleCamera,
ToggleFullscreen,
ToggleShadows,
Restart,
@ -283,6 +285,14 @@ pub fn update_menu(
let onoff = bool2string(settings.map_active);
text.sections[i].value = format!("Map: {onoff} [M]\n");
}
MenuAction::ToggleCamera => {
let onoff = if settings.third_person {
"3rd Person"
} else {
"1st Person"
};
text.sections[i].value = format!("Camera: {onoff} [C]\n");
}
MenuAction::ToggleShadows => {
let onoff = if settings.shadows_sun {
"Flashlight + Sun"
@ -353,6 +363,10 @@ pub fn handle_input(
ew_game.send(GameEvent::SetSound(Toggle));
ew_updatemenu.send(UpdateMenuEvent);
},
MenuAction::ToggleCamera => {
ew_game.send(GameEvent::SetThirdPerson(Toggle));
ew_updatemenu.send(UpdateMenuEvent);
},
MenuAction::ToggleFullscreen => {
ew_game.send(GameEvent::SetFullscreen(Toggle));
},