extern crate glium; extern crate topaz; extern crate aventurine; use glium::{glutin,Surface}; use std::rc::Rc; pub struct Event { window_event: Option, id: usize } impl topaz::Event for Event { fn get_id(&self) -> usize { self.id } fn with_id(id: usize) -> Self { Self { window_event: None, id: id } } } impl aventurine::AventurineEvent for Event { fn get_window_event(&self) -> Option { self.window_event.clone() } fn with_window_event(id: usize, event: aventurine::WindowEvent) -> Self { Self { window_event: Some(event), id: id } } } struct BlankWindowSystem{ display: glium::Display } impl topaz::System for BlankWindowSystem { fn operate(&self, _: &mut topaz::Universe, _: Rc) { let mut target = self.display.draw(); target.clear_color(1.0,1.0,1.0,1.0); target.finish().unwrap(); } } fn main() { let mut universe: topaz::Universe = topaz::Universe::new(()); let events_loop = glutin::EventsLoop::new(); let window = glutin::WindowBuilder::new(); let context = glutin::ContextBuilder::new(); let display = glium::Display::new(window, context, &events_loop).unwrap(); let mut handler = aventurine::EventSystem::new(events_loop); handler.on_close = Some(topaz::EVENT_QUIT); let display_system = BlankWindowSystem { display: display }; universe.add_and_subscribe(Rc::new(handler),vec![topaz::EVENT_UPDATE]); universe.add_and_subscribe(Rc::new(display_system),vec![topaz::EVENT_UPDATE]); universe.run() }