split into file

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-05-08 23:20:57 +02:00
parent 0313e7e6f3
commit 65088be75c
3 changed files with 33 additions and 32 deletions

31
src/apps.rs Normal file
View file

@ -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<Box<dyn App>> {
vec![
Box::new(Spotify {}),
Box::new(Radio {}),
Box::new(Settings {}),
]
}

View file

@ -24,6 +24,7 @@ fn main() {
use glutin::prelude::*;
mod apps;
mod hid;
mod roundy_math;
mod ui;

View file

@ -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<Box<dyn App>> {
vec![
Box::new(Spotify {}),
Box::new(Radio {}),
Box::new(Settings {}),
]
}