Skip to content

Commit

Permalink
fix(examples): use WindowAttributes to create winit::Window in ex…
Browse files Browse the repository at this point in the history
…amples
  • Loading branch information
apekros committed Oct 31, 2024
1 parent a6b52d1 commit 512c105
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
8 changes: 4 additions & 4 deletions examples/bunnymark/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ fn main() {
env_logger::init();

let event_loop = winit::event_loop::EventLoop::new().unwrap();
let window = winit::window::WindowBuilder::new()
.with_title("blade-bunnymark")
.build(&event_loop)
.unwrap();
let window_attributes =
winit::window::Window::default_attributes().with_title("blade-bunnymark");

let window = event_loop.create_window(window_attributes).unwrap();

#[cfg(target_arch = "wasm32")]
{
Expand Down
10 changes: 5 additions & 5 deletions examples/move/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ impl Game {
fn new(event_loop: &winit::event_loop::EventLoop<()>) -> Self {
log::info!("Initializing");

let window = winit::window::WindowBuilder::new()
.with_title("Move")
.build(event_loop)
.unwrap();
let window_attributes =
winit::window::Window::default_attributes().with_title("blade-move");

let window = event_loop.create_window(window_attributes).unwrap();

let camera = ControlledCamera {
inner: Camera {
Expand Down Expand Up @@ -89,7 +89,7 @@ impl Game {
let egui_context = egui::Context::default();
let egui_viewport_id = egui_context.viewport_id();
let egui_state =
egui_winit::State::new(egui_context, egui_viewport_id, &window, None, None);
egui_winit::State::new(egui_context, egui_viewport_id, &window, None, None, None);

Self {
engine,
Expand Down
9 changes: 4 additions & 5 deletions examples/ray-query/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,10 @@ fn main() {
env_logger::init();

let event_loop = winit::event_loop::EventLoop::new().unwrap();
let window = winit::window::WindowBuilder::new()
.with_title("blade-ray-query")
.with_transparent(true)
.build(&event_loop)
.unwrap();
let window_attributes =
winit::window::Window::default_attributes().with_title("blade-ray-query");

let window = event_loop.create_window(window_attributes).unwrap();

let mut example = Example::new(&window);

Expand Down
9 changes: 4 additions & 5 deletions examples/scene/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,14 +792,13 @@ fn main() {
env_logger::init();

let event_loop = winit::event_loop::EventLoop::new().unwrap();
let window = winit::window::WindowBuilder::new()
.with_title("blade-scene")
.build(&event_loop)
.unwrap();
let window_attributes = winit::window::Window::default_attributes().with_title("blade-scene");

let window = event_loop.create_window(window_attributes).unwrap();

let egui_ctx = egui::Context::default();
let viewport_id = egui_ctx.viewport_id();
let mut egui_winit = egui_winit::State::new(egui_ctx, viewport_id, &window, None, None);
let mut egui_winit = egui_winit::State::new(egui_ctx, viewport_id, &window, None, None, None);

let mut args = std::env::args();
let path_to_scene = args
Expand Down
9 changes: 4 additions & 5 deletions examples/vehicle/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ impl Game {
fn new(event_loop: &winit::event_loop::EventLoop<()>) -> Self {
log::info!("Initializing");

let window = winit::window::WindowBuilder::new()
.with_title("RayCraft")
.build(event_loop)
.unwrap();
let window_attributes = winit::window::Window::default_attributes().with_title("RayCraft");

let window = event_loop.create_window(window_attributes).unwrap();

let cam_config = config::Camera {
distance: 5.0,
Expand Down Expand Up @@ -306,7 +305,7 @@ impl Game {
let egui_context = egui::Context::default();
let egui_viewport_id = egui_context.viewport_id();
let egui_state =
egui_winit::State::new(egui_context, egui_viewport_id, &window, None, None);
egui_winit::State::new(egui_context, egui_viewport_id, &window, None, None, None);

Self {
engine,
Expand Down

0 comments on commit 512c105

Please sign in to comment.