1use bevy::prelude::App as BevyApp;
2use bevy::prelude::*;
3use honeycomb_core::cmap::CMap2;
4use honeycomb_core::geometry::CoordsFloat;
5
6use crate::capture::{Capture, CaptureList};
7use crate::plugins::{CapturePlugin, GuiPlugin, OptionsPlugin, ScenePlugin};
8
9pub struct App {
15 pub app: BevyApp,
17 capture_list: CaptureList,
18}
19
20impl App {
21 pub fn add_capture<T: CoordsFloat>(&mut self, cmap: &CMap2<T>) -> usize {
24 let cap_id = self.capture_list.0.len();
25 let capture = Capture::new(cap_id, cmap);
26 self.capture_list.0.push(capture);
27 cap_id
28 }
29
30 pub fn run(mut self) {
32 self.app.insert_resource(self.capture_list);
33 self.app.run();
34 }
35}
36
37impl Default for App {
38 fn default() -> Self {
39 let mut app = BevyApp::new();
40 app.insert_resource(Msaa::Sample4)
42 .insert_resource(ClearColor(Color::srgb(0.9, 0.9, 0.9)));
43 app.add_plugins(DefaultPlugins)
45 .add_plugins(OptionsPlugin)
46 .add_plugins(GuiPlugin)
47 .add_plugins(ScenePlugin)
48 .add_plugins(CapturePlugin);
49 Self {
50 app,
51 capture_list: CaptureList(Vec::new()),
52 }
53 }
54}