bevyengine / bevyengine/bevy

Make it easier to position multiple windows in code

Open
#10,201 0 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Usability S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.11

```ignore
`AdapterInfo { name: "Intel(R) UHD Graphics 630 (CML GT2)", vendor: 32902, device: 39880, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.1.8-manjaro1.1", backend: Vulkan }`
```

## What you did

I want to use a second window separate from the main window to display the inspector information, and now I am faced with several problems:
1. I want the second window to automatically be next to the main window, but I can't find any API to do that.
2. When I manually set the position of the second window, it showed up on a different screen than the one where the main window was.

Note: I have two monitor screens

## Additional information
the code:
```rust
fn toggle_inspector(
mut commands: Commands,
input: Res>,
inspector_win_query: Query, With)>,
) {
if inspector_win_query.is_empty() {
if input.just_pressed(KeyCode::F1) {
commands.spawn((
Window {
title: "检查器窗口".to_owned(),
resolution: [500., 768.].into(),
// When the position is not set, it is displayed in the same monitor as the main window, and if the position is set, it is not displayed in the same monitor
// position: WindowPosition::new(IVec2::new(1024, 0)),
..default()
},
InspectorWindow,
));
}
}
}
```
screenshot:
![image](https://github.com/bevyengine/bevy/assets/5027439/d4b43751-cc5b-4937-86f9-87dafe2e9ea0)

the result i want:
![image](https://github.com/bevyengine/bevy/assets/5027439/7c4613bc-016b-48e7-bac3-3d74c7cf5410)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.