diff --git a/src/lib.rs b/src/lib.rs index daee459..b43b277 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,6 @@ use std::cell::RefCell; use std::rc::Rc; use std::any::Any; -use piston::{ event, window }; use gfx::traits::*; use gfx_graphics::{ Gfx2d, GfxGraphics }; @@ -33,7 +32,7 @@ type Glyphs = gfx_graphics::GlyphCache = GfxGraphics<'a, gfx_device_gl::Resources, gfx_device_gl::CommandBuffer, gfx_device_gl::Output>; /// Contains everything required for controlling window, graphics, event loop. -pub struct PistonWindow { +pub struct PistonWindow { /// The window. pub window: Rc>, /// GFX stream. @@ -43,9 +42,9 @@ pub struct PistonWindow { /// Gfx2d. pub g2d: Rc>>, /// The event loop. - pub events: Rc>>>, + pub events: Rc>>>, /// The event. - pub event: Option>, + pub event: Option>, /// Application structure. pub app: Rc>, /// The factory that was created along with the device. @@ -62,7 +61,7 @@ impl From for PistonWindow } impl Clone for PistonWindow - where W: window::Window, W::Event: Clone + where W: Window, W::Event: Clone { fn clone(&self) -> Self { PistonWindow { @@ -79,11 +78,11 @@ impl Clone for PistonWindow } impl PistonWindow - where W: window::Window, W::Event: event::GenericEvent + where W: Window, W::Event: GenericEvent { /// Creates a new piston object. pub fn new(window: Rc>, app: Rc>) -> Self - where W: window::OpenGLWindow + where W: OpenGLWindow { use piston::event::Events; use piston::window::{ OpenGLWindow, Window }; @@ -161,7 +160,7 @@ impl PistonWindow } impl Iterator for PistonWindow - where W: window::Window, W::Event: event::GenericEvent + where W: Window, W::Event: GenericEvent { type Item = PistonWindow; @@ -195,13 +194,13 @@ impl Iterator for PistonWindow } } -impl event::GenericEvent for PistonWindow - where W: window::Window, W::Event: event::GenericEvent +impl GenericEvent for PistonWindow + where W: Window, W::Event: GenericEvent { - fn event_id(&self) -> event::EventId { + fn event_id(&self) -> EventId { match self.event { Some(ref e) => e.event_id(), - None => event::EventId("") + None => EventId("") } } @@ -211,9 +210,9 @@ impl event::GenericEvent for PistonWindow self.event.as_ref().unwrap().with_args(f) } - fn from_args(event_id: event::EventId, any: &Any, old_event: &Self) -> Option { + fn from_args(event_id: EventId, any: &Any, old_event: &Self) -> Option { if let Some(ref e) = old_event.event { - match event::GenericEvent::from_args(event_id, any, e) { + match GenericEvent::from_args(event_id, any, e) { Some(e) => { Some(PistonWindow { window: old_event.window.clone(), @@ -232,22 +231,22 @@ impl event::GenericEvent for PistonWindow } } -impl window::Window for PistonWindow - where W: window::Window +impl Window for PistonWindow + where W: Window { - type Event = ::Event; + type Event = ::Event; fn should_close(&self) -> bool { self.window.borrow().should_close() } - fn size(&self) -> window::Size { self.window.borrow().size() } - fn draw_size(&self) -> window::Size { self.window.borrow().draw_size() } + fn size(&self) -> Size { self.window.borrow().size() } + fn draw_size(&self) -> Size { self.window.borrow().draw_size() } fn swap_buffers(&mut self) { self.window.borrow_mut().swap_buffers() } fn poll_event(&mut self) -> Option { - window::Window::poll_event(&mut *self.window.borrow_mut()) + Window::poll_event(&mut *self.window.borrow_mut()) } } -impl window::AdvancedWindow for PistonWindow - where W: window::AdvancedWindow +impl AdvancedWindow for PistonWindow + where W: AdvancedWindow { fn get_title(&self) -> String { self.window.borrow().get_title() } fn set_title(&mut self, title: String) {