-
-
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
Cleanup consistency of position types in bevy_window
#5004
Comments
Replacing tuples with vector types seems like a no-brainer to me, considering the fact that they are already used in such context somewhere else. |
Related to #4960 |
Resolves bevyengine#5004. As suggested in the original issue, change tuple types to their corresponding vector type. ## migration guide Changed the following fields - `WindowCommand::SetWindowMode.resolution` from `(u32, u32)` to `UVec2` - `WindowCommand::SetResolution.logical_resolution` from `(f32, f32)` to `Vec2` Co-authored-by: Daniel Liu <mr.picklepinosaur@gmail.com>
Resolves bevyengine#5004. As suggested in the original issue, change tuple types to their corresponding vector type. ## migration guide Changed the following fields - `WindowCommand::SetWindowMode.resolution` from `(u32, u32)` to `UVec2` - `WindowCommand::SetResolution.logical_resolution` from `(f32, f32)` to `Vec2` Co-authored-by: Daniel Liu <mr.picklepinosaur@gmail.com>
Resolves bevyengine#5004. As suggested in the original issue, change tuple types to their corresponding vector type. ## migration guide Changed the following fields - `WindowCommand::SetWindowMode.resolution` from `(u32, u32)` to `UVec2` - `WindowCommand::SetResolution.logical_resolution` from `(f32, f32)` to `Vec2` Co-authored-by: Daniel Liu <mr.picklepinosaur@gmail.com>
What problem does this solve or what need does it fill?
When interacting with windows in bevy and positions thereof,
bevy_window
presents the user with quite a variety of units without too much clarity or direction on why:Winit behind the scenes works in either
Logical
orPhysical
units for sizes and positions.physical
meaning "physical pixels", usually in the form ofu32
logical
meaning "logical pixels" which are f32 / f64 values and usually a helper type to define sizes before any scaling has been applied.What solution would you like?
I think it would improve consistency if the end user of bevy was encountered with a similar interface. Either by reexporting winit's definitions or by building some new types better suited for bevy's userspace.
What alternative(s) have you considered?
Keep using native types such as vectors and ints to not clutter the userspace with additional types. Most new users will quickly become familiar with
Vec2
/IVec2
so keep using that might be preferable? If yes, I'd prefer all tuples become vectors so that we don't mix them.The text was updated successfully, but these errors were encountered: