From 3057df1e7ca3b6f1411b01bd344a768d14448210 Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Fri, 10 Dec 2021 16:32:59 -0800 Subject: [PATCH] implementing changing the scenes --- src/modules/stream_states/enums.rs | 2 +- .../stream_states/stream_states_class.rs | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/modules/stream_states/enums.rs b/src/modules/stream_states/enums.rs index 5874c16..b82de74 100644 --- a/src/modules/stream_states/enums.rs +++ b/src/modules/stream_states/enums.rs @@ -1,5 +1,5 @@ -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Copy)] pub enum Scenes { CameraDefault, CameraWithUpperRight, diff --git a/src/modules/stream_states/stream_states_class.rs b/src/modules/stream_states/stream_states_class.rs index 534fadf..b57dc02 100644 --- a/src/modules/stream_states/stream_states_class.rs +++ b/src/modules/stream_states/stream_states_class.rs @@ -43,4 +43,28 @@ impl StreamStates { pub fn new() -> Self { StreamStates{..Default::default()} } + + pub fn change_scene(self, scene: &enums::Scenes) -> Self { + match scene { + enums::Scenes::CameraDefault | enums::Scenes::CameraWithUpperRight | + enums::Scenes::CameraWithLargeUpperRight | enums::Scenes::CameraWithLowerRight + => {StreamStates::set_camera_scene(self, scene)}, + enums::Scenes::ScreenDefault | enums::Scenes::ScreenWithUpperRight | + enums::Scenes::ScreenWithLowerRight + => {StreamStates::set_screen_scene(self, scene)}, + + } + } + + fn set_camera_scene(mut self, scene: &enums::Scenes) -> Self{ + self.camera_sub_scene = scene.clone(); + self.current_scene = scene.clone(); + self + } + + fn set_screen_scene(mut self, scene: &enums::Scenes) -> Self { + self.screen_sub_scene = scene.clone(); + self.current_scene = scene.clone(); + self + } }