Window

Window

  • cursor_options : bevy_window::window::CursorOptions
  • present_mode : bevy_window::window::PresentMode
  • mode : bevy_window::window::WindowMode
  • position : bevy_window::window::WindowPosition
  • resolution : bevy_window::window::WindowResolution
  • title : String
  • name : core::option::Optionalloc::string::String
  • composite_alpha_mode : bevy_window::window::CompositeAlphaMode
  • resize_constraints : bevy_window::window::WindowResizeConstraints
  • resizable : bool
  • enabled_buttons : bevy_window::window::EnabledButtons
  • decorations : bool
  • transparent : bool
  • focused : bool
  • window_level : bevy_window::window::WindowLevel
  • canvas : core::option::Optionalloc::string::String
  • fit_canvas_to_parent : bool
  • prevent_default_event_handling : bool
  • internal : bevy_window::window::InternalWindowState
  • ime_enabled : bool
  • ime_position : glam::Vec2
  • window_theme : core::option::Option<bevy_window::window::WindowTheme>
  • visible : bool
  • skip_taskbar : bool
  • desired_maximum_frame_latency : core::option::Optioncore::num::NonZeroU32
  • recognize_pinch_gesture : bool
  • recognize_rotation_gesture : bool
  • recognize_doubletap_gesture : bool
  • recognize_pan_gesture : core::option::Option<(u8, u8)>
  • movable_by_window_background : bool
  • fullsize_content_view : bool
  • has_shadow : bool
  • titlebar_shown : bool
  • titlebar_transparent : bool
  • titlebar_show_title : bool
  • titlebar_show_buttons : bool

Description

The defining [Component] for window entities, storing information about how it should appear and behave.

Each window corresponds to an entity, and is uniquely identified by the value of their [Entity]. When the [Window] component is added to an entity, a new window will be opened. When it is removed or the entity is despawned, the window will close.

The primary window entity (and the corresponding window) is spawned by default by WindowPlugin and is marked with the [PrimaryWindow] component.

This component is synchronized with winit through bevy_winit: it will reflect the current state of the window and can be modified to change this state.

Example

Because this component is synchronized with winit, it can be used to perform OS-integrated windowing operations. For example, here's a simple system to change the window mode:

# use bevy_ecs::query::With; # use bevy_ecs::system::Query; # use bevy_window::{WindowMode, PrimaryWindow, Window, MonitorSelection}; fn change_window_mode(mut windows: Query<&mut Window, With<PrimaryWindow>>) { // Query returns one window typically. for mut window in windows.iter_mut() { window.mode = WindowMode::Fullscreen(MonitorSelection::Current); } }

Functions