Skip to content

Commit

Permalink
Replace deprecated simple_logger initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
lberrymage authored Sep 10, 2020
1 parent c66489d commit e475499
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 21 deletions.
3 changes: 2 additions & 1 deletion examples/control_flow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{thread, time};

use simple_logger::SimpleLogger;
use winit::{
event::{Event, KeyboardInput, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -17,7 +18,7 @@ const WAIT_TIME: time::Duration = time::Duration::from_millis(100);
const POLL_SLEEP_TIME: time::Duration = time::Duration::from_millis(100);

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();

println!("Press '1' to switch to Wait mode.");
println!("Press '2' to switch to WaitUntil mode.");
Expand Down
3 changes: 2 additions & 1 deletion examples/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use simple_logger::SimpleLogger;
use winit::{
event::{ElementState, Event, KeyboardInput, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::{CursorIcon, WindowBuilder},
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 2 additions & 1 deletion examples/cursor_grab.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use simple_logger::SimpleLogger;
use winit::{
event::{DeviceEvent, ElementState, Event, KeyboardInput, ModifiersState, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/custom_events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[cfg(not(target_arch = "wasm32"))]
fn main() {
use simple_logger::SimpleLogger;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -11,7 +12,7 @@ fn main() {
Timer,
}

simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::<CustomEvent>::with_user_event();

let _window = WindowBuilder::new()
Expand Down
4 changes: 3 additions & 1 deletion examples/fullscreen.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use std::io::{stdin, stdout, Write};

use simple_logger::SimpleLogger;
use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::monitor::{MonitorHandle, VideoMode};
use winit::window::{Fullscreen, WindowBuilder};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

print!("Please choose the fullscreen mode: (1) exclusive, (2) borderless: ");
Expand Down
3 changes: 2 additions & 1 deletion examples/handling_close.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use simple_logger::SimpleLogger;
use winit::{
event::{Event, KeyboardInput, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let _window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/min_max_size.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use simple_logger::SimpleLogger;
use winit::{
dpi::LogicalSize,
event::{Event, WindowEvent},
Expand All @@ -6,7 +7,7 @@ use winit::{
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 2 additions & 1 deletion examples/minimize.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
extern crate winit;

use simple_logger::SimpleLogger;
use winit::event::{Event, VirtualKeyCode, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::WindowBuilder;

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/monitor_list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use simple_logger::SimpleLogger;
use winit::{event_loop::EventLoop, window::WindowBuilder};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();
let window = WindowBuilder::new().build(&event_loop).unwrap();

Expand Down
3 changes: 2 additions & 1 deletion examples/multithreaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
fn main() {
use std::{collections::HashMap, sync::mpsc, thread, time::Duration};

use simple_logger::SimpleLogger;
use winit::{
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
Expand All @@ -12,7 +13,7 @@ fn main() {
const WINDOW_COUNT: usize = 3;
const WINDOW_SIZE: PhysicalSize<u32> = PhysicalSize::new(600, 400);

simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();
let mut window_senders = HashMap::with_capacity(WINDOW_COUNT);
for _ in 0..WINDOW_COUNT {
Expand Down
4 changes: 3 additions & 1 deletion examples/multiwindow.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use std::collections::HashMap;

use simple_logger::SimpleLogger;
use winit::{
event::{ElementState, Event, KeyboardInput, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::Window,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let mut windows = HashMap::new();
Expand Down
3 changes: 2 additions & 1 deletion examples/request_redraw.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use simple_logger::SimpleLogger;
use winit::{
event::{ElementState, Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/request_redraw_threaded.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use std::{thread, time};

use simple_logger::SimpleLogger;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/resizable.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use simple_logger::SimpleLogger;
use winit::{
dpi::LogicalSize,
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
Expand All @@ -6,7 +7,7 @@ use winit::{
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let mut resizable = false;
Expand Down
4 changes: 3 additions & 1 deletion examples/timer.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use instant::Instant;
use std::time::Duration;

use simple_logger::SimpleLogger;
use winit::{
event::{Event, StartCause, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let _window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/transparent.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use simple_logger::SimpleLogger;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/video_modes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use simple_logger::SimpleLogger;
use winit::event_loop::EventLoop;

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();
let monitor = match event_loop.primary_monitor() {
Some(monitor) => monitor,
Expand Down
3 changes: 2 additions & 1 deletion examples/window.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use simple_logger::SimpleLogger;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion examples/window_debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This example is used by developers to test various window functions.

use simple_logger::SimpleLogger;
use winit::{
dpi::{LogicalSize, PhysicalSize},
event::{DeviceEvent, ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
Expand All @@ -8,7 +9,7 @@ use winit::{
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
4 changes: 3 additions & 1 deletion examples/window_icon.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
extern crate image;
use std::path::Path;

use simple_logger::SimpleLogger;
use winit::{
event::Event,
event_loop::{ControlFlow, EventLoop},
window::{Icon, WindowBuilder},
};

fn main() {
simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();

// You'll have to choose an icon size at your own discretion. On X11, the desired size varies
// by WM, and on Windows, you still have to account for screen scaling. Here we use 32px,
Expand Down
4 changes: 3 additions & 1 deletion examples/window_run_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
))]
fn main() {
use std::{thread::sleep, time::Duration};

use simple_logger::SimpleLogger;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -18,7 +20,7 @@ fn main() {
};
let mut event_loop = EventLoop::new();

simple_logger::init().unwrap();
SimpleLogger::new().init().unwrap();
let _window = WindowBuilder::new()
.with_title("A fantastic window!")
.build(&event_loop)
Expand Down

0 comments on commit e475499

Please sign in to comment.