diff options
author | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-08-02 08:24:30 +0200 |
---|---|---|
committer | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-08-02 08:29:37 +0200 |
commit | 5dda16702164d59a75d8c36373cf29a8d7f4d58f (patch) | |
tree | c087244f783b60dff1baf46d7f7cc6f6d206fc50 /examples | |
parent | 959613870c23e2ca26bee268c46f8062095c2382 (diff) | |
download | glutin-5dda16702164d59a75d8c36373cf29a8d7f4d58f.tar.gz glutin-5dda16702164d59a75d8c36373cf29a8d7f4d58f.zip |
Add iterators for events and WindowBuilder
Diffstat (limited to 'examples')
-rw-r--r-- | examples/fullscreen.rs | 11 | ||||
-rw-r--r-- | examples/window.rs | 6 |
2 files changed, 8 insertions, 9 deletions
diff --git a/examples/fullscreen.rs b/examples/fullscreen.rs index b6141a0..80e6089 100644 --- a/examples/fullscreen.rs +++ b/examples/fullscreen.rs @@ -5,8 +5,6 @@ extern crate gl; use std::io::stdio::stdin; fn main() { - use std::default::Default; - // enumerating monitors let monitor = { for (num, monitor) in init::get_available_monitors().enumerate() { @@ -23,8 +21,11 @@ fn main() { monitor }; - let window = init::Window::new(None, "Hello world!", &Default::default(), - Some(monitor)).unwrap(); + let window = init::WindowBuilder::new() + .with_title("Hello world!".to_string()) + .with_monitor(monitor) + .build() + .unwrap(); unsafe { window.make_current() }; @@ -40,7 +41,7 @@ fn main() { gl::ClearColor(0.0, 1.0, 0.0, 1.0); while !window.is_closed() { - println!("{}", window.wait_events()); + println!("{}", window.wait_events().collect::<Vec<init::Event>>()); gl::Clear(gl::COLOR_BUFFER_BIT); diff --git a/examples/window.rs b/examples/window.rs index daa856b..c366ee0 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -3,9 +3,7 @@ extern crate libc; extern crate gl; fn main() { - use std::default::Default; - - let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap(); + let window = init::Window::new().unwrap(); unsafe { window.make_current() }; @@ -21,7 +19,7 @@ fn main() { gl::ClearColor(0.0, 1.0, 0.0, 1.0); while !window.is_closed() { - println!("{}", window.wait_events()); + println!("{}", window.wait_events().collect::<Vec<init::Event>>()); gl::Clear(gl::COLOR_BUFFER_BIT); |