From 60d3198e4126408c675704882f279ce29823d676 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 13 May 2024 23:51:18 +0200 Subject: [PATCH] add Camera to menu --- src/menu.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/menu.rs b/src/menu.rs index 2c2000b..bce6828 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -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)); },