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

Centering windows doesn't take scale_factor_override into account #8916

Closed
alice-i-cecile opened this issue Jun 21, 2023 · 1 comment · Fixed by #13949
Closed

Centering windows doesn't take scale_factor_override into account #8916

alice-i-cecile opened this issue Jun 21, 2023 · 1 comment · Fixed by #13949
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@alice-i-cecile
Copy link
Member

          This doesn't take into account `scale_factor_override` (maybe it shouldn't? I'm trying to write the documentation for `WindowResolution` in https://github.com/bevyengine/bevy/pull/8858 and I have a hard time understanding how it works, or what is a bug and what is intended behavior)

For example this doesn't spawn at the center of the screen (when default scale_factor is 1., before and after this PR so not a regression at least):

Window {
    position: WindowPosition::Centered(MonitorSelection::Primary),
    resolution: WindowResolution::new(500., 300.).with_scale_factor_override(2.0),
    ..default()
}

Originally posted by @Selene-Amanita in #8903 (comment)

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Windowing Platform-agnostic interface layer to run your app in S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Jun 21, 2023
@alice-i-cecile
Copy link
Member Author

As discussed in that thread, it's unclear what the intended behavior should be, and if this is even a bug. Splitting it out here to track though.

github-merge-queue bot pushed a commit that referenced this issue Jun 24, 2024
…#13949)

# Objective

Fixes #8916 

My game has a low resolution pixel art style, and I use
`.with_scale_factor_override()` to make the window larger.
`WindowPosition::Centered` doesn't work for me.

## Solution

If `scale_factor_override` is set, use that over `monitor.scale_factor`

## Testing

Tested on Windows 11 with an Nvidia GPU:

### Main

![image](https://github.com/bevyengine/bevy/assets/3324533/5f9ae90e-b65a-48d9-b601-117df8f08a28)

### This PR

![image](https://github.com/bevyengine/bevy/assets/3324533/cd860611-7b6a-4ae5-b690-28d9ba8ea6ad)
mockersf pushed a commit that referenced this issue Jun 26, 2024
…#13949)

# Objective

Fixes #8916 

My game has a low resolution pixel art style, and I use
`.with_scale_factor_override()` to make the window larger.
`WindowPosition::Centered` doesn't work for me.

## Solution

If `scale_factor_override` is set, use that over `monitor.scale_factor`

## Testing

Tested on Windows 11 with an Nvidia GPU:

### Main

![image](https://github.com/bevyengine/bevy/assets/3324533/5f9ae90e-b65a-48d9-b601-117df8f08a28)

### This PR

![image](https://github.com/bevyengine/bevy/assets/3324533/cd860611-7b6a-4ae5-b690-28d9ba8ea6ad)
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-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant