Add an os module containing platform-specific traits
This commit is contained in:
parent
9fccb2e06e
commit
8c6a27d426
6 changed files with 113 additions and 29 deletions
31
src/lib.rs
31
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue