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

Bracket bevy feedback #269

Closed
bayou-brogrammer opened this issue Jun 13, 2022 · 5 comments
Closed

Bracket bevy feedback #269

bayou-brogrammer opened this issue Jun 13, 2022 · 5 comments

Comments

@bayou-brogrammer
Copy link
Contributor

bayou-brogrammer commented Jun 13, 2022

Hey just wanted to share some feedback while poking around in the bevy branch!

First off, on exiting of the program, bracket-bevy seems to throw an error on unwrapping of the window in the mouse system


let (camera, camera_transform) = q_camera.single();
    let wnd = if let RenderTarget::Window(id) = camera.target {
        wnds.get(id).unwrap()
    } else {
        wnds.get_primary().unwrap()
    };

Which is odd since bracket-bevy is just a plug-in of systems running in bevy so I would think bevy wouldn't update the system on app exit. A quick google search didn't lead me down and successive results on why the system would still run.

Point 2: it seems that when importing bracket-bevy, and bevy as specific git branches, I am clashing when importing bracket-pathfinding. When implementing base map or alrogithm2D, the compiler is complaining that two different versions of bracket-geometry are being used. Pretty odd since they are locked at the same version.

I plan to continue to mess around with the plug-in but would love to help out if you could use it!

EDIT:

Sorry im just dumb on point #2. I have to use the specific git branch for each bracket library. Silly me

Edit #2:
Did some more digging into the window unwrapping issue when the window is closed manually or by the bevy::window::close_on_esc. Seems bevy closes every window, and then once every window is closed, it then sends out the AppExit event which triggers the shutdown of the application. If you simple insert the AppExit event, everything shuts down cleanly without the error being produced.

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(BTermBuilder::simple_80x50().with_random_number_generator(true))
        .add_startup_system(setup)
        .add_system(tick)
        .add_system(exit_system)
        .run();
}

fn exit_system(mut exit: EventWriter<AppExit>) {
    exit.send(AppExit);
}
@bayou-brogrammer
Copy link
Contributor Author

One issue with the scaler, for non-resizing modes, the scaler can produce negative usize results resulting in a panic by rust. My debugs are not very helpful, but you can see that h (height) is 25, but the step_pos.1 is 26 resulting in a negative overflow.

Testing with TerminalScalingMode::ResizeTerminals works fine since it actually updates the height and width

CleanShot.2022-06-13.at.19.31.31.mp4

@bayou-brogrammer
Copy link
Contributor Author

Went ahead and fixed the window issue! #270

@thebracket
Copy link
Collaborator

There's a few overflow crashes right now. I goofed when I translated from Bevy and used a bunch of usize where i32 made sense (negatives can make sense when calculating UI positions, even if they aren't used) - as well as a few "print command parameters are in a different order than the main library" type things - so I'll be fixing those. Once that's done, I'll get some safety checks into the scaler.

Funny Bevy issue. I can't find a way to set window size from a plugin, because the window size resource is read before plugin instantiation. :-|

@alice-i-cecile
Copy link

@thebracket that's effectively a known limitation. We either need to solve bevyengine/bevy#5111 or bevyengine/bevy#1255 to resolve that.

@bayou-brogrammer
Copy link
Contributor Author

Closing this in favor of 0.8 coming out. Alot of changes will happen. I created a seperate issue (#281 )to track more things I have noticed.

@bayou-brogrammer bayou-brogrammer closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants