Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump wgpu to 0.19 and winit to 0.29 #391

Merged
merged 14 commits into from
Sep 22, 2024
Prev Previous commit
Next Next commit
Fix minimal-tao example
Removed menu as it's no longer supported directly by `tao`.
mkrasnitski authored and parasyte committed Sep 22, 2024
commit 7ac3a0e4be01201d1559c96b5c926d1a818eab5e
2 changes: 1 addition & 1 deletion examples/minimal-tao/Cargo.toml
Original file line number Diff line number Diff line change
@@ -14,4 +14,4 @@ env_logger = "0.10"
error-iter = "0.4"
log = "0.4"
pixels = { path = "../.." }
tao = "0.20"
tao = "0.24"
17 changes: 6 additions & 11 deletions examples/minimal-tao/src/main.rs
Original file line number Diff line number Diff line change
@@ -4,11 +4,11 @@
use error_iter::ErrorIter as _;
use log::error;
use pixels::{Error, Pixels, SurfaceTexture};
use std::sync::Arc;
use tao::dpi::LogicalSize;
use tao::event::{Event, KeyEvent, WindowEvent};
use tao::event_loop::{ControlFlow, EventLoop};
use tao::keyboard::KeyCode;
use tao::menu::{MenuBar, MenuItem};
use tao::window::WindowBuilder;

const WIDTH: u32 = 320;
@@ -27,25 +27,20 @@ fn main() -> Result<(), Error> {
env_logger::init();
let event_loop = EventLoop::new();
let window = {
let mut file_menu = MenuBar::new();
file_menu.add_native_item(MenuItem::Quit);

let mut menu = MenuBar::new();
menu.add_submenu("File", true, file_menu);

let size = LogicalSize::new(WIDTH as f64, HEIGHT as f64);
WindowBuilder::new()
let window = WindowBuilder::new()
.with_title("Hello Pixels/Tao")
.with_menu(menu)
.with_inner_size(size)
.with_min_inner_size(size)
.build(&event_loop)
.unwrap()
.unwrap();
Arc::new(window)
};

let mut pixels = {
let window_size = window.inner_size();
let surface_texture = SurfaceTexture::new(window_size.width, window_size.height, &window);
let surface_texture =
SurfaceTexture::new(window_size.width, window_size.height, Arc::clone(&window));
Pixels::new(WIDTH, HEIGHT, surface_texture)?
};
let mut world = World::new();