diff --git a/src/apps.rs b/src/apps.rs new file mode 100644 index 0000000..9e52376 --- /dev/null +++ b/src/apps.rs @@ -0,0 +1,31 @@ +pub trait App { + fn name(&self) -> &str; +} + +struct Spotify; +impl App for Spotify { + fn name(&self) -> &str { + "Spotify" + } +} +struct Radio; +impl App for Radio { + fn name(&self) -> &str { + "Radio" + } +} + +struct Settings; +impl App for Settings { + fn name(&self) -> &str { + "Settings" + } +} + +pub fn get_apps() -> Vec> { + vec![ + Box::new(Spotify {}), + Box::new(Radio {}), + Box::new(Settings {}), + ] +} diff --git a/src/main.rs b/src/main.rs index 81c257f..ae8efaf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,6 +24,7 @@ fn main() { use glutin::prelude::*; +mod apps; mod hid; mod roundy_math; mod ui; diff --git a/src/ui.rs b/src/ui.rs index d723f54..53d6dee 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -2,6 +2,7 @@ use femtovg::{Align, Baseline, Canvas, Color, Paint, Path, Renderer}; use crate::{hid::Beo5Event, Fonts}; +use crate::apps::{get_apps, App}; use crate::roundy_math; pub struct Beo { @@ -134,35 +135,3 @@ impl Beo { canvas.fill_path(&path, &ellipse_color); } } - -pub trait App { - fn name(&self) -> &str; -} - -struct Spotify; -impl App for Spotify { - fn name(&self) -> &str { - "Spotify" - } -} -struct Radio; -impl App for Radio { - fn name(&self) -> &str { - "Radio" - } -} - -struct Settings; -impl App for Settings { - fn name(&self) -> &str { - "Settings" - } -} - -fn get_apps() -> Vec> { - vec![ - Box::new(Spotify {}), - Box::new(Radio {}), - Box::new(Settings {}), - ] -}