-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Change Window
scale factor to f32
#8942
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Hmm EDIT: oh ok I need to rebase on main, did not see the changes on main. Working on it. |
Great! We need a second approval before we can merge this :) In this case I'm going to pull in both @JMS55 (rendering expert) and @ickshonpe (UI expert who requested the change). P.S. I couldn't request |
I'll take a look when I get home this evening. |
These are the changes I had in mind when I wrote up this issue, and the implementation looks good. I'll run through some examples just to make sure everything is okay. I should have written up the original issue better though. For Bevy UI there should be no problems, even with something silly like a resolution ten times larger than 8k single-precision floats should be enough. But I don't know if (for example) there might be complications caused by the changes to I think even if there are complications, they wouldn't block most of the changes as we can just convert the values from Window at access and otherwise use f32s internally. |
The other case in which there could be issues is very long scrollable views. But fixing this would likely require f64 everywhere (or a fixed point value where 1 = 1/60th like web browsers use), not just for the scale factor. |
c87ebc2
to
fd32c6f
Compare
Are you planning to remake this from an alternate branch? |
back online, my bad. |
examples/ui/ui_scaling.rs
Outdated
self.start_scale = self.current_scale(); | ||
self.target_scale = scale; | ||
self.target_time.reset(); | ||
} | ||
|
||
fn current_scale(&self) -> f64 { | ||
fn current_scale(&self) -> f32 { | ||
let completion = self.target_time.percent(); | ||
let multiplier = ease_in_expo(completion as f64); |
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.
should ease_in_expo be changed to take a f32 also?
Window
scale factor to f32
@thmsgntz can you please resolve the merge conflicts so we can merge this? @ickshonpe, can I get your review? |
Sure, I will have some free time this weekend to work on it |
# Conflicts: # crates/bevy_text/src/pipeline.rs # crates/bevy_ui/src/layout/mod.rs # crates/bevy_ui/src/lib.rs # crates/bevy_ui/src/render/mod.rs # crates/bevy_ui/src/ui_node.rs # crates/bevy_ui/src/widget/text.rs # crates/bevy_window/src/window.rs # crates/bevy_winit/src/lib.rs
Modify ease_in_expo to take an f32 instead of f64
I think I'm done but I need help to fix these problems with
And I do not know how to fix errors from
|
Adopted in #10897 <3 Thanks for getting this started! |
Hi!
This is my first contribution! I am not familiar yet with everything in Bevy so I am opened to criticism to learn :)
Objective
Fixes #8900
Solution
scale_factor
ofWindow
andUI
from f64 to f32Changelog
Structs changed:
Tests changed:
Migration Guide
If manipulating
scale_factor
, some conversion from f64 to f32 may be necessary.