From 65088be75cb94a1b1dae990b666a108b1a831224 Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Wed, 8 May 2024 23:20:57 +0200 Subject: [PATCH] split into file Signed-off-by: Frank Villaro-Dixon --- src/apps.rs | 31 +++++++++++++++++++++++++++++++ src/main.rs | 1 + src/ui.rs | 33 +-------------------------------- 3 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 src/apps.rs 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 {}), - ] -}