mirror of
https://github.com/bevyengine/bevy
synced 2024-11-14 08:58:04 +00:00
82aa2e3161
# Objective Expose the `winit` functions [drag_window](https://docs.rs/winit/latest/winit/window/struct.Window.html#method.drag_window) and [resize_window](https://docs.rs/winit/latest/winit/window/struct.Window.html#method.drag_resize_window). Which allows implementing move & resize for windows without decorations. ## Solution Add the functions `start_drag_move` and `start_drag_resize` to `bevy_window::Window`, which are then assigned to fields in `InternalWindowState`, and propagated to `winit` in the `changed_windows` system. ## Testing I've tested that both functions works on x11 and wayland. Not sure if someone needs to test on windows/mac? --- ## Showcase [Screencast from 2024-10-06 11-49-58 (trimmed).webm](https://github.com/user-attachments/assets/1cdee7b1-22bd-41d3-8a0a-6872a6ebf62c) (The flickering in the video is some issue with resizing without decorations on x11) <details> <summary>Click to view showcase</summary> Not the same code used in the video, but simple way to test moving a window without decorations. ```rust use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { decorations: false, ..default() }), ..default() })) .add_systems(Update, move_windows) .run(); } fn move_windows(mut windows: Query<&mut Window>, input: Res<ButtonInput<MouseButton>>) { if input.pressed(MouseButton::Left) { for mut window in windows.iter_mut() { window.start_drag_move(); } } } ``` </details> --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_image | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mesh | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_remote | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |