dave: prepare for android

This commit is contained in:
William Casarin
2025-03-26 09:20:46 -07:00
parent cb7a3adacf
commit 4469918fd2
8 changed files with 70 additions and 211 deletions

View File

@@ -0,0 +1,37 @@
// Entry point for wasm
//#[cfg(target_arch = "wasm32")]
//use wasm_bindgen::prelude::*;
pub struct Chrome {
active: i32,
apps: Vec<Box<dyn notedeck::App>>,
}
impl Chrome {
pub fn new() -> Self {
Chrome {
active: 0,
apps: vec![],
}
}
pub fn add_app(&mut self, app: impl notedeck::App + 'static) {
self.apps.push(Box::new(app));
}
pub fn set_active(&mut self, app: i32) {
self.active = app;
}
}
impl notedeck::App for Chrome {
fn update(&mut self, ctx: &mut notedeck::AppContext, ui: &mut egui::Ui) {
let active = self.active;
self.apps[active as usize].update(ctx, ui);
//for i in 0..self.apps.len() {
// self.apps[i].update(ctx, ui);
//}
}
}