1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#![feature(arc_new_cyclic)] /*! Riddle platform system implementation based on `winit`, managing the OS's main event loop and windowing system. # Riddle Example The **recommended** way to use this crate is through the main `riddle` crate. Riddle exposes this crate through `riddle::platform`. ```no_run use riddle::{*, platform::*}; fn main() -> Result<(), RiddleError> { let rdl = RiddleLib::new()?; let window = WindowBuilder::new().build(rdl.context())?; rdl.run(move |rdl| { match rdl.event() { Event::Platform(PlatformEvent::WindowClose(_)) => rdl.quit(), _ => (), } }) } ``` # Direct Example If you don't want to depend on `riddle`, you can use this crate directly. There isn't much point in doing so over using `winit` directly though - the main function of this crate is to integrate `winit` in to Riddle. ```no_run use riddle_platform_winit::*; fn main() -> Result<(), PlatformError> { let (platform_system, main_thread_state) = PlatformSystem::new(); let window = WindowBuilder::new().build(main_thread_state.borrow_context())?; main_thread_state.run::<PlatformError, _>(move |ctx| { match ctx.event() { PlatformEvent::WindowClose(_) => { ctx.quit(); } _ => () }; Ok(()) }) } ``` */ mod dimensions; mod error; mod event; mod platform_context; mod platform_system; mod window; mod window_map; pub use error::PlatformError; pub use platform_context::*; pub use platform_system::*; pub use riddle_platform_common as common; pub use window::*; pub use common::PlatformEvent; use riddle_common::*; use window_map::*; type Result<R> = std::result::Result<R, PlatformError>;