-
Notifications
You must be signed in to change notification settings - Fork 948
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Remove Sync and Clone from EventsLoop. Add EventsLoopProxy.
This commit only updates the top-level API to get some early feedback. None of the platform-specific code has been updated yet. I'm hoping to get around to this over the next couple days however if someone more familiar with the windows backend would like to do a PR against this fork that would be a great help. Closes #187.
- Loading branch information
1 parent
7298df7
commit c2d3941
Showing
3 changed files
with
54 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
extern crate winit; | ||
|
||
fn main() { | ||
let events_loop = winit::EventsLoop::new(); | ||
|
||
let window = winit::WindowBuilder::new() | ||
.with_title("A fantastic window!") | ||
.build(&events_loop) | ||
.unwrap(); | ||
|
||
let proxy = events_loop.create_proxy(); | ||
|
||
std::thread::spawn(move || { | ||
// Wake up the `events_loop` once every second. | ||
loop { | ||
std::thread::sleep(std::time::Duration::from_secs(1)); | ||
proxy.wakeup(); | ||
} | ||
}); | ||
|
||
events_loop.run_forever(|event| { | ||
println!("{:?}", event); | ||
match event { | ||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => | ||
events_loop.interrupt(), | ||
_ => () | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.