Update all dependencies (#130)

This commit is contained in:
Jay Oster 2021-01-05 18:20:36 -08:00 committed by GitHub
parent efb64078ec
commit 0a893d6eff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 84 additions and 72 deletions

View file

@ -13,7 +13,7 @@ jobs:
rust: rust:
- stable - stable
- beta - beta
- 1.41.0 - 1.43.0
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -40,7 +40,7 @@ jobs:
rust: rust:
- stable - stable
- beta - beta
- 1.41.0 - 1.43.0
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v2

View file

@ -22,12 +22,12 @@ include = [
pollster = "0.2" pollster = "0.2"
raw-window-handle = "0.3" raw-window-handle = "0.3"
thiserror = "1.0" thiserror = "1.0"
ultraviolet = "0.4" ultraviolet = "0.7"
wgpu = "0.6" wgpu = "0.6"
[dev-dependencies] [dev-dependencies]
pixels-mocks = { path = "internals/pixels-mocks" } pixels-mocks = { path = "internals/pixels-mocks" }
winit = "0.22" winit = "0.24"
[workspace] [workspace]
members = [ members = [

View file

@ -10,12 +10,12 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
byteorder = "1.3.4" byteorder = "1.3"
env_logger = "0.7.1" env_logger = "0.8"
getrandom = "0.1.14" getrandom = "0.2"
line_drawing = "0.8.0" line_drawing = "0.8"
log = "0.4.8" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
randomize = "3.0.1" randomize = "3.0"
winit = "0.22.0" winit = "0.24"
winit_input_helper = "0.6.0" winit_input_helper = "0.9"

View file

@ -42,7 +42,7 @@ fn main() -> Result<(), Error> {
// For everything else, for let winit_input_helper collect events to build its state. // For everything else, for let winit_input_helper collect events to build its state.
// It returns `true` when it is time to update our game state and request a redraw. // It returns `true` when it is time to update our game state and request a redraw.
if input.update(event) { if input.update(&event) {
// Close events // Close events
if input.key_pressed(VirtualKeyCode::Escape) || input.quit() { if input.key_pressed(VirtualKeyCode::Escape) || input.quit() {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;
@ -150,13 +150,14 @@ fn create_window(
let width = SCREEN_WIDTH as f64; let width = SCREEN_WIDTH as f64;
let height = SCREEN_HEIGHT as f64; let height = SCREEN_HEIGHT as f64;
let (monitor_width, monitor_height) = { let (monitor_width, monitor_height) = {
let size = window.current_monitor().size(); if let Some(monitor) = window.current_monitor() {
( let size = monitor.size().to_logical(hidpi_factor);
size.width as f64 / hidpi_factor, (size.width, size.height)
size.height as f64 / hidpi_factor, } else {
) (width, height)
}
}; };
let scale = (monitor_height / height * 2.0 / 3.0).round(); let scale = (monitor_height / height * 2.0 / 3.0).round().max(1.0);
// Resize, center, and display the window // Resize, center, and display the window
let min_size: winit::dpi::LogicalSize<f64> = let min_size: winit::dpi::LogicalSize<f64> =

View file

@ -10,8 +10,8 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
env_logger = "0.7.1" env_logger = "0.8"
log = "0.4.8" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
winit = "0.22.0" winit = "0.24"
winit_input_helper = "0.6.0" winit_input_helper = "0.9"

View file

@ -72,7 +72,7 @@ fn main() -> Result<(), Error> {
} }
// Handle input events // Handle input events
if input.update(event) { if input.update(&event) {
// Close events // Close events
if input.key_pressed(VirtualKeyCode::Escape) || input.quit() { if input.key_pressed(VirtualKeyCode::Escape) || input.quit() {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;

View file

@ -10,11 +10,11 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
env_logger = "0.7" env_logger = "0.8"
imgui = "0.4" imgui = "0.6"
imgui-wgpu = "0.9" imgui-wgpu = "0.12"
imgui-winit-support = { version = "0.4", default-features = false, features = ["winit-22"] } imgui-winit-support = "0.6"
log = "0.4" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
winit = "0.22" winit = "0.24"
winit_input_helper = "0.6" winit_input_helper = "0.9"

View file

@ -22,7 +22,7 @@ impl Gui {
let mut platform = imgui_winit_support::WinitPlatform::init(&mut imgui); let mut platform = imgui_winit_support::WinitPlatform::init(&mut imgui);
platform.attach_window( platform.attach_window(
imgui.io_mut(), imgui.io_mut(),
&window, window,
imgui_winit_support::HiDpiMode::Default, imgui_winit_support::HiDpiMode::Default,
); );
@ -51,7 +51,11 @@ impl Gui {
let device = pixels.device(); let device = pixels.device();
let queue = pixels.queue(); let queue = pixels.queue();
let texture_format = wgpu::TextureFormat::Bgra8UnormSrgb; let texture_format = wgpu::TextureFormat::Bgra8UnormSrgb;
let renderer = imgui_wgpu::Renderer::new(&mut imgui, &device, &queue, texture_format); let config = imgui_wgpu::RendererConfig {
texture_format,
..Default::default()
};
let renderer = imgui_wgpu::Renderer::new(&mut imgui, &device, &queue, config);
// Return GUI context // Return GUI context
Self { Self {
@ -70,9 +74,10 @@ impl Gui {
window: &winit::window::Window, window: &winit::window::Window,
) -> Result<(), winit::error::ExternalError> { ) -> Result<(), winit::error::ExternalError> {
// Prepare Dear ImGui // Prepare Dear ImGui
let io = self.imgui.io_mut(); let now = Instant::now();
self.last_frame = io.update_delta_time(self.last_frame); self.imgui.io_mut().update_delta_time(now - self.last_frame);
self.platform.prepare_frame(io, window) self.last_frame = now;
self.platform.prepare_frame(self.imgui.io_mut(), window)
} }
/// Render Dear ImGui. /// Render Dear ImGui.

View file

@ -79,7 +79,7 @@ fn main() -> Result<(), Error> {
// Handle input events // Handle input events
gui.handle_event(&window, &event); gui.handle_event(&window, &event);
if input.update(event) { if input.update(&event) {
// Close events // Close events
if input.key_pressed(VirtualKeyCode::Escape) || input.quit() { if input.key_pressed(VirtualKeyCode::Escape) || input.quit() {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;
@ -124,7 +124,7 @@ impl World {
/// Draw the `World` state to the frame buffer. /// Draw the `World` state to the frame buffer.
/// ///
/// Assumes the default texture format: [`wgpu::TextureFormat::Rgba8UnormSrgb`] /// Assumes the default texture format: `wgpu::TextureFormat::Rgba8UnormSrgb`
fn draw(&self, frame: &mut [u8]) { fn draw(&self, frame: &mut [u8]) {
for (i, pixel) in frame.chunks_exact_mut(4).enumerate() { for (i, pixel) in frame.chunks_exact_mut(4).enumerate() {
let x = (i % WIDTH as usize) as i16; let x = (i % WIDTH as usize) as i16;

View file

@ -10,13 +10,13 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
byteorder = "1.3.4" byteorder = "1.3"
env_logger = "0.7.1" env_logger = "0.8"
getrandom = "0.1.14" getrandom = "0.2"
gilrs = "0.7.4" gilrs = "0.8"
log = "0.4.8" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
randomize = "3.0.1" randomize = "3.0"
simple-invaders = { path = "simple-invaders" } simple-invaders = { path = "simple-invaders" }
winit = "0.22.0" winit = "0.24"
winit_input_helper = "0.6.0" winit_input_helper = "0.9"

View file

@ -11,4 +11,4 @@ randomize = "3.0"
[dev-dependencies] [dev-dependencies]
byteorder = "1.3" byteorder = "1.3"
getrandom = "0.1" getrandom = "0.2"

View file

@ -60,7 +60,7 @@ fn main() -> Result<(), Error> {
// For everything else, for let winit_input_helper collect events to build its state. // For everything else, for let winit_input_helper collect events to build its state.
// It returns `true` when it is time to update our game state and request a redraw. // It returns `true` when it is time to update our game state and request a redraw.
if input.update(event) { if input.update(&event) {
// Close events // Close events
if input.key_pressed(VirtualKeyCode::Escape) || input.quit() { if input.key_pressed(VirtualKeyCode::Escape) || input.quit() {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;
@ -142,13 +142,14 @@ fn create_window(
let width = SCREEN_WIDTH as f64; let width = SCREEN_WIDTH as f64;
let height = SCREEN_HEIGHT as f64; let height = SCREEN_HEIGHT as f64;
let (monitor_width, monitor_height) = { let (monitor_width, monitor_height) = {
let size = window.current_monitor().size(); if let Some(monitor) = window.current_monitor() {
( let size = monitor.size().to_logical(hidpi_factor);
size.width as f64 / hidpi_factor, (size.width, size.height)
size.height as f64 / hidpi_factor, } else {
) (width, height)
}
}; };
let scale = (monitor_height / height * 2.0 / 3.0).round(); let scale = (monitor_height / height * 2.0 / 3.0).round().max(1.0);
// Resize, center, and display the window // Resize, center, and display the window
let min_size = PhysicalSize::new(width, height).to_logical::<f64>(hidpi_factor); let min_size = PhysicalSize::new(width, height).to_logical::<f64>(hidpi_factor);

View file

@ -86,7 +86,7 @@ impl World {
/// Draw the `World` state to the frame buffer. /// Draw the `World` state to the frame buffer.
/// ///
/// Assumes the default texture format: [`wgpu::TextureFormat::Rgba8UnormSrgb`] /// Assumes the default texture format: `wgpu::TextureFormat::Rgba8UnormSrgb`
fn draw(&self, frame: &mut [u8]) { fn draw(&self, frame: &mut [u8]) {
for (i, pixel) in frame.chunks_exact_mut(4).enumerate() { for (i, pixel) in frame.chunks_exact_mut(4).enumerate() {
let x = (i % WIDTH as usize) as i16; let x = (i % WIDTH as usize) as i16;

View file

@ -10,8 +10,8 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
env_logger = "0.7.1" env_logger = "0.7"
log = "0.4.8" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
winit = "0.22.0" winit = "0.24"
winit_input_helper = "0.6.0" winit_input_helper = "0.9"

View file

@ -57,7 +57,7 @@ fn main() -> Result<(), Error> {
} }
// Handle input events // Handle input events
if input.update(event) { if input.update(&event) {
// Close events // Close events
if input.key_pressed(VirtualKeyCode::Escape) || input.quit() { if input.key_pressed(VirtualKeyCode::Escape) || input.quit() {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;
@ -102,7 +102,7 @@ impl World {
/// Draw the `World` state to the frame buffer. /// Draw the `World` state to the frame buffer.
/// ///
/// Assumes the default texture format: [`wgpu::TextureFormat::Rgba8UnormSrgb`] /// Assumes the default texture format: `wgpu::TextureFormat::Rgba8UnormSrgb`
fn draw(&self, frame: &mut [u8]) { fn draw(&self, frame: &mut [u8]) {
for (i, pixel) in frame.chunks_exact_mut(4).enumerate() { for (i, pixel) in frame.chunks_exact_mut(4).enumerate() {
let x = (i % WIDTH as usize) as i16; let x = (i % WIDTH as usize) as i16;

View file

@ -10,10 +10,10 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
env_logger = "0.7" env_logger = "0.8"
euclid = "0.20" euclid = "0.22"
log = "0.4" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }
raqote = { version = "0.8", default-features = false } raqote = { git = "https://github.com/jrmuizel/raqote.git", rev = "74f0afa2be54561c1a9928e885ab95e8a4c5322d", default-features = false }
winit = "0.22" winit = "0.24"
winit_input_helper = "0.6" winit_input_helper = "0.9"

View file

@ -67,7 +67,7 @@ fn main() -> Result<(), Error> {
} }
// Handle input events // Handle input events
if input.update(event) { if input.update(&event) {
// Close events // Close events
if input.key_pressed(VirtualKeyCode::Escape) || input.quit() { if input.key_pressed(VirtualKeyCode::Escape) || input.quit() {
*control_flow = ControlFlow::Exit; *control_flow = ControlFlow::Exit;

View file

@ -55,9 +55,14 @@ impl Shapes {
a: 0xff, a: 0xff,
}); });
self.t1 = self.t1.post_translate(Vector2D::new(-self.cx, -self.cy)); let translate = Vector2D::new(-self.cx, -self.cy).to_transform();
self.t1 = self.t1.post_rotate(Angle { radians: delta }); let inv_translate = translate
self.t1 = self.t1.post_translate(Vector2D::new(self.cx, self.cy)); .inverse()
.unwrap_or_else(|| Vector2D::new(self.cx, self.cy).to_transform());
self.t1 = self.t1.then(&translate);
self.t1 = self.t1.then_rotate(Angle::radians(delta));
self.t1 = self.t1.then(&inv_translate);
self.dt.set_transform(&self.t1); self.dt.set_transform(&self.t1);
let mut pb = PathBuilder::new(); let mut pb = PathBuilder::new();
@ -91,9 +96,9 @@ impl Shapes {
); );
self.dt.fill(&path, &gradient, &DrawOptions::new()); self.dt.fill(&path, &gradient, &DrawOptions::new());
self.t2 = self.t2.post_translate(Vector2D::new(-self.cx, -self.cy)); self.t2 = self.t2.then(&translate);
self.t2 = self.t2.post_rotate(Angle { radians: -delta }); self.t2 = self.t2.then_rotate(Angle::radians(-delta));
self.t2 = self.t2.post_translate(Vector2D::new(self.cx, self.cy)); self.t2 = self.t2.then(&inv_translate);
self.dt.set_transform(&self.t2); self.dt.set_transform(&self.t2);
let mut pb = PathBuilder::new(); let mut pb = PathBuilder::new();