-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Use updated window size in bevymark example #3335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
My one concern with this is that bevymark is intended to be a benchmark, to test bevy's sprite performance across platforms - I'm not sure how useful having the window be resizable is for that purpose.
That being said, if we do choose to go that route, we should also lock the scale factor and make the window not resizable, which we don't do currently.
This PR is fixing another issue stemming of #2879, so may as well have the backlink from that to here.
examples/tools/bevymark.rs
Outdated
let bird_x = (window.width / -2.) + HALF_BIRD_SIZE; | ||
let bird_y = (window.height / 2.) - HALF_BIRD_SIZE; | ||
let window = windows.get_primary().unwrap(); | ||
let bird_x = (window.physical_width() as f32 / -2.) + HALF_BIRD_SIZE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this physical width?
That makes the behaviour with a non-1 scale factor is to spawn the birds off-screen, and let them bounce off-screen. That doesn't seem ideal for a benchmark, as it might make the performance seem better (as off-screen sprites are planned to be culled). I think bevymark is meant to be a stress-test for sprite rendering, not culling behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah my bad, it shouldn't use the physical size, I will fix it.
I agree with your concern for the usefulness of resizing, though the main issue I had here was the use of WindowDescriptor since it gave the wrong impression (to me at least) that WindowDescriptor would be updated.
If we don't want the window to be resizable, it should set |
Yup I agree that this is a positive change because it encourages people to follow best practices (accessing WindowDescriptor data at runtime is rarely a good idea). Possibly worth disabling window resizing, but im cool with merging this as is. |
bors r+ |
# Objective Have the bird spawning/collision systems in bevymark use the proper window size, instead of the size set in WindowDescriptor which isn't updated when the window is resized. ## Solution Use the Windows resource to grab the width/height from the primary window. This is consistent with the other examples.
Objective
Have the bird spawning/collision systems in bevymark use the proper window size, instead of the size set in WindowDescriptor which isn't updated when the window is resized.
Solution
Use the Windows resource to grab the width/height from the primary window. This is consistent with the other examples.