radarmp/mp/src/lib.rs
2024-11-19 16:12:59 +08:00

39 lines
1.1 KiB
Rust

use mp_elements;
use tokio::runtime::Runtime;
pub mod app;
pub mod windows_manager;
pub use makepad_widgets;
pub use makepad_widgets::makepad_draw;
pub use makepad_widgets::makepad_platform;
pub mod app_ui;
pub mod errors;
pub mod file;
pub mod menu;
pub mod render_task;
pub mod widgets;
use mp_core::{config::Setting, datapool::DataPool, plugin_system::PluginManager};
use once_cell::sync::Lazy;
use std::env;
pub static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().unwrap());
pub static CONFIG: Lazy<Setting> = Lazy::new(|| Setting::new());
pub static PLUGIN_MANAGER: Lazy<PluginManager> = Lazy::new(|| {
PluginManager::new(
env::current_dir().unwrap().join(
(CONFIG.common.plugins)
.as_ref()
.unwrap_or(&"loaders".into()),
),
)
.unwrap()
});
pub static DATAPOOL: Lazy<DataPool> = Lazy::new(|| DataPool::new(&PLUGIN_MANAGER, 10));
pub static GIAPP: Lazy<mp_elements::App> = Lazy::new(|| {
RUNTIME.block_on(async {
let mut app = mp_elements::App::instant().await;
app.init().await;
app
})
});