From 9ca9e38d8b54011e41832add18bde6602a635aad Mon Sep 17 00:00:00 2001 From: Lexi Blesius Date: Thu, 28 Mar 2024 15:11:30 +0100 Subject: [PATCH] Mock spawn camera This doesn't do anything useful. Commit just kept around in case I need to revisit this. `_setup_camera` commented out for the moment because we observed the error mentioned in the comment (https://github.com/bevyengine/bevy/issues/11734). With `do_nothing`, we get this: ``` 2024-03-28T11:58:43.553731Z ERROR log: X11 error: XError { description: "BadWindow (invalid Window parameter)", error_code: 3, request_code: 148, minor_code: 1, } 2024-03-28T11:58:43.567517Z ERROR bevy_winit: winit event loop returned an error: os error at /home/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:427: Xlib error: X error: BadWindow (invalid Window parameter) (code: 3, request code: 148, minor code: 1) ``` --- src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.rs b/src/main.rs index d216c17..fddc906 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,21 @@ use bevy::prelude::*; fn main() { App::new() + // this crashes when closing the window with https://github.com/bevyengine/bevy/issues/11734 + // .add_systems(Startup, setup_camera) + // this does NOT crash, instead has this: https://gist.github.com/Ablesius/f8ed4b0a7252e49d1a4380189cae19eb + // try: replaced call to do_nothing with () + .add_systems(Startup, do_nothing) .add_plugins(DefaultPlugins) .run(); } + +fn _setup_camera(mut commands: Commands) { + // need to deviate from the blog entry + // based on https://github.com/marcusbuffett/bevy_snake/commit/d7f263735dd8cc7ef5d94b961f1f7554ece780a3#r113302872 + commands.spawn(Camera2dBundle::default()); +} + +// TODO: drop-in +// remove as soon as _setup_camera works +fn do_nothing() {} \ No newline at end of file