implementing changing the scenes

This commit is contained in:
Nickiel12 2021-12-10 16:32:59 -08:00
parent fef2475ef2
commit 3057df1e7c
2 changed files with 25 additions and 1 deletions

View file

@ -1,5 +1,5 @@
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug, Clone, Copy)]
pub enum Scenes { pub enum Scenes {
CameraDefault, CameraDefault,
CameraWithUpperRight, CameraWithUpperRight,

View file

@ -43,4 +43,28 @@ impl StreamStates {
pub fn new() -> Self { pub fn new() -> Self {
StreamStates{..Default::default()} 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
}
} }