Skip to content

Commit

Permalink
Fix fullscreen example
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Aug 29, 2017
1 parent ca38acb commit d83c269
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use std::io::{self, Write};
use winit::{ControlFlow, Event, WindowEvent, FullScreenState};

fn main() {
let mut events_loop = winit::EventsLoop::new();

// enumerating monitors
let monitor = {
for (num, monitor) in winit::get_available_monitors().enumerate() {
for (num, monitor) in events_loop.get_available_monitors().enumerate() {
println!("Monitor #{}: {:?}", num, monitor.get_name());
}

Expand All @@ -16,15 +18,13 @@ fn main() {
let mut num = String::new();
io::stdin().read_line(&mut num).unwrap();
let num = num.trim().parse().ok().expect("Please enter a number");
let monitor = winit::get_available_monitors().nth(num).expect("Please enter a valid ID");
let monitor = events_loop.get_available_monitors().nth(num).expect("Please enter a valid ID");

println!("Using {:?}", monitor.get_name());

monitor
};

let mut events_loop = winit::EventsLoop::new();

let _window = winit::WindowBuilder::new()
.with_title("Hello world!")
.with_fullscreen(FullScreenState::Exclusive(monitor))
Expand Down

0 comments on commit d83c269

Please sign in to comment.