extern crate xloop_types as types; pub mod app; pub mod error; pub mod win; pub mod prelude {} #[derive(Debug)] pub struct Platform; impl types::Platform for Platform { type Error = error::Error; type AppRef<'a> = app::AppRef<'a>; type AppHandle = app::AppHandle; type AppProxy = app::AppProxy; type WinRef<'a> = win::WinRef<'a>; type WinHandle = win::WinHandle; type WinRaw = win::WinRaw; type EvtMouse<'a> = win::WinEvent<'a>; type EvtWheel<'a> = win::WinEvent<'a>; type EvtKey<'a> = win::WinEvent<'a>; type EvtTouch<'a> = win::WinEvent<'a>; type EvtCommit<'a> = &'a types::EvtCommit; fn run(delegate: impl types::AppDelegate + 'static) -> Result, Self::Error> { let app = app::AppDelegate::build(delegate); unsafe { app.run() }; Ok(None) } fn win(_key: impl AsRef, delegate: impl types::WinDelegate + 'static) -> Result { let window = win::XLoopWindow::new(delegate); unsafe { window.setReleasedWhenClosed(false) }; Ok(win::WinHandle(window)) } fn log(level: log::LevelFilter) { env_logger::builder().filter_level(level).init(); } fn read(path: impl AsRef) -> Option> { use objc2_foundation::NSBundle; let bundle = NSBundle::mainBundle(); let res = unsafe { bundle.resourcePath() }?; let res: std::path::PathBuf = res.to_string().into(); let file = res.join(path); std::fs::read(file).ok() } }