From 8c6a27d42615fc97b1aed31c20c3aff3d25c88d4 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 25 Sep 2015 18:04:55 +0200 Subject: Add an `os` module containing platform-specific traits --- src/lib.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 8e54560..a9c9bef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,7 +61,7 @@ extern crate x11_dl; pub use events::*; pub use headless::{HeadlessRendererBuilder, HeadlessContext}; #[cfg(feature = "window")] -pub use window::{WindowBuilder, Window, WindowProxy, PollEventsIterator, WaitEventsIterator}; +pub use window::{WindowBuilder, WindowProxy, PollEventsIterator, WaitEventsIterator}; #[cfg(feature = "window")] pub use window::{AvailableMonitorsIter, MonitorId, get_available_monitors, get_primary_monitor}; #[cfg(feature = "window")] @@ -78,6 +78,35 @@ mod headless; #[cfg(feature = "window")] mod window; +pub mod os; + +/// Represents an OpenGL context and the Window or environment around it. +/// +/// # Example +/// +/// ```ignore +/// let window = Window::new().unwrap(); +/// +/// unsafe { window.make_current() }; +/// +/// loop { +/// for event in window.poll_events() { +/// match(event) { +/// // process events here +/// _ => () +/// } +/// } +/// +/// // draw everything here +/// +/// window.swap_buffers(); +/// std::old_io::timer::sleep(17); +/// } +/// ``` +pub struct Window { + window: platform::Window, +} + /// Trait that describes objects that have access to an OpenGL context. pub trait GlContext { /// Sets the context as the current context. -- cgit v1.2.3