Fill the windows in the examples with a solid color

Fixes #776.
This commit is contained in:
John Nunley 2023-06-19 11:46:38 -07:00 committed by GitHub
parent 4748890935
commit b2a46d0439
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 264 additions and 19 deletions

View file

@ -2,7 +2,7 @@
#[cfg(not(wasm_platform))]
fn main() {
use std::{thread, time};
use std::{sync::Arc, thread, time};
use simple_logger::SimpleLogger;
use winit::{
@ -11,17 +11,26 @@ fn main() {
window::WindowBuilder,
};
#[path = "util/fill.rs"]
mod fill;
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();
let window = WindowBuilder::new()
.with_title("A fantastic window!")
.build(&event_loop)
.unwrap();
let window = {
let window = WindowBuilder::new()
.with_title("A fantastic window!")
.build(&event_loop)
.unwrap();
Arc::new(window)
};
thread::spawn(move || loop {
thread::sleep(time::Duration::from_secs(1));
window.request_redraw();
thread::spawn({
let window = window.clone();
move || loop {
thread::sleep(time::Duration::from_secs(1));
window.request_redraw();
}
});
event_loop.run(move |event, _, control_flow| {
@ -36,6 +45,7 @@ fn main() {
} => control_flow.set_exit(),
Event::RedrawRequested(_) => {
println!("\nredrawing!\n");
fill::fill_window(&window);
}
_ => (),
}