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

[Merged by Bors] - Make ScalingMode more flexible #3253

Closed
wants to merge 8 commits into from
Closed

[Merged by Bors] - Make ScalingMode more flexible #3253

wants to merge 8 commits into from

Conversation

Daniikk1012
Copy link
Contributor

Adds ability to specify scaling factor for WindowSize, size of the fixed axis for FixedVertical and FixedHorizontal and a new ScalingMode that is a mix of FixedVertical and FixedHorizontal

The issue

Currently, only available options are to:

  • Have one of the axes fixed to value 1
  • Have viewport size match the window size
  • Manually adjust viewport size

In most of the games these options are not enough and more advanced scaling methods have to be used

Solution

The solution is to provide additional parameters to current scaling modes, like scaling factor for WindowSize. Additionally, a more advanced Auto mode is added, which dynamically switches between behaving like FixedVertical and FixedHorizontal depending on the window's aspect ratio.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 5, 2021
@DJMcNab
Copy link
Member

DJMcNab commented Dec 5, 2021

How are these new fields different to the scale field which already exists?

That being said, the auto mode seems useful.

@Daniikk1012
Copy link
Contributor Author

These fields are there because scale is usually used for zooming, so it is better to separate "zoom" scale and "viewport" scale.

@alice-i-cecile alice-i-cecile added A-Windowing Platform-agnostic interface layer to run your app in C-Usability A simple quality-of-life change that makes Bevy easier to use S-Needs-Review and removed S-Needs-Triage This issue needs to be labelled labels Dec 5, 2021
Add additional fields to existing modes and add an additional Auto mode
@Daniikk1012
Copy link
Contributor Author

Right now, in this pull request there is Auto mode, which uses the smallest possible viewport size that is at least the provided size while keeping the aspect ratio. Here is the question: can a viewport that uses the biggest possible viewport size that is at most the provided size be useful and should it be added as well?

@alice-i-cecile alice-i-cecile added C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide and removed S-Needs-Migration-Guide labels Jan 20, 2022
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the addition of Auto quite a bit.

However I don't like the addition of an additional way to scale the window viewport. Can you strip down this PR?

@Daniikk1012
Copy link
Contributor Author

What about the parameters in FixedVertical and FixedHorizontal? There it is not just the scale, but the desired length of a specific side, should that be removed as well?

@alice-i-cecile
Copy link
Member

Hmm. I personally think we should keep those; I can see the appeal there.

@Daniikk1012
Copy link
Contributor Author

Daniikk1012 commented May 17, 2022

Apparently, right now FixedHorizontal and FixedVertical will give you different total widh/height depending on the window_origin field of the projection (Bounds would be -1.0..1.0 if WindowOrigin::Center is used, but 0.0..1.0 if WindowOrigin::BottomLeft is used). In this implementation however, it does not work that way, so I added additional commit to account for this.

@alice-i-cecile
Copy link
Member

Excellent, I'm happy with this now.

@alice-i-cecile
Copy link
Member

@Daniikk1012 can you resolve the comment threads that you've addressed? It makes it much easier to follow for future reviewers.

Copy link
Contributor

@inodentry inodentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to approve these changes. It improves on what we had previously, in multiple ways. I feel this PR is in a good shape now.

Any additional fixes/improvements/nitpicks can always come via additional PRs, of course. :)

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label May 25, 2022
@alice-i-cecile
Copy link
Member

bors r+

@alice-i-cecile
Copy link
Member

@Daniikk1012 can you please rebase this so it can be merged?

@alice-i-cecile
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented May 30, 2022

Merge conflict.

@alice-i-cecile
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented May 30, 2022

Merge conflict.

@alice-i-cecile
Copy link
Member

alice-i-cecile commented May 30, 2022

Apparently more merge conflicts. You have my sympathies @Daniikk1012...

Thanks for your patience through all this.

@Daniikk1012
Copy link
Contributor Author

Sorry, I still do not understand how to work with git properly (My first time resolving a merge conflict). This should work now

@alice-i-cecile
Copy link
Member

Git can be a bit of a pain; it's not just you :) This looks good now, thanks!

bors r+

bors bot pushed a commit that referenced this pull request May 31, 2022
Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis for `FixedVertical` and `FixedHorizontal` and a new `ScalingMode` that is a mix of `FixedVertical` and `FixedHorizontal`

# The issue

Currently, only available options are to:

* Have one of the axes fixed to value 1
* Have viewport size match the window size
* Manually adjust viewport size

In most of the games these options are not enough and more advanced scaling methods have to be used

## Solution

The solution is to provide additional parameters to current scaling modes, like scaling factor for `WindowSize`. Additionally, a more advanced `Auto` mode is added, which dynamically switches between behaving like `FixedVertical` and `FixedHorizontal` depending on the window's aspect ratio.

Co-authored-by: Daniikk1012 <49123959+Daniikk1012@users.noreply.github.com>
@bors bors bot changed the title Make ScalingMode more flexible [Merged by Bors] - Make ScalingMode more flexible May 31, 2022
@bors bors bot closed this May 31, 2022
james7132 pushed a commit to james7132/bevy that referenced this pull request Jun 7, 2022
Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis for `FixedVertical` and `FixedHorizontal` and a new `ScalingMode` that is a mix of `FixedVertical` and `FixedHorizontal`

# The issue

Currently, only available options are to:

* Have one of the axes fixed to value 1
* Have viewport size match the window size
* Manually adjust viewport size

In most of the games these options are not enough and more advanced scaling methods have to be used

## Solution

The solution is to provide additional parameters to current scaling modes, like scaling factor for `WindowSize`. Additionally, a more advanced `Auto` mode is added, which dynamically switches between behaving like `FixedVertical` and `FixedHorizontal` depending on the window's aspect ratio.

Co-authored-by: Daniikk1012 <49123959+Daniikk1012@users.noreply.github.com>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis for `FixedVertical` and `FixedHorizontal` and a new `ScalingMode` that is a mix of `FixedVertical` and `FixedHorizontal`

# The issue

Currently, only available options are to:

* Have one of the axes fixed to value 1
* Have viewport size match the window size
* Manually adjust viewport size

In most of the games these options are not enough and more advanced scaling methods have to be used

## Solution

The solution is to provide additional parameters to current scaling modes, like scaling factor for `WindowSize`. Additionally, a more advanced `Auto` mode is added, which dynamically switches between behaving like `FixedVertical` and `FixedHorizontal` depending on the window's aspect ratio.

Co-authored-by: Daniikk1012 <49123959+Daniikk1012@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants