pub struct WindowPlugin {
pub primary_window: Option<Window>,
pub primary_cursor_options: Option<CursorOptions>,
pub exit_condition: ExitCondition,
pub close_when_requested: bool,
}Expand description
A Plugin that defines an interface for windowing support in Bevy.
Fields§
§primary_window: Option<Window>Settings for the primary window.
Some(custom_window) will spawn an entity with custom_window and PrimaryWindow as components.
None will not spawn a primary window.
Defaults to Some(Window::default()).
Note that if there are no windows the App will exit (by default) due to
exit_on_all_closed.
primary_cursor_options: Option<CursorOptions>Settings for the cursor on the primary window.
Defaults to Some(CursorOptions::default()).
Has no effect if WindowPlugin::primary_window is None.
exit_condition: ExitConditionWhether to exit the app when there are no open windows.
If disabling this, ensure that you send the bevy_app::AppExit
event when the app should exit. If this does not occur, you will
create ‘headless’ processes (processes without windows), which may
surprise your users. It is recommended to leave this setting to
either ExitCondition::OnAllClosed or ExitCondition::OnPrimaryClosed.
ExitCondition::OnAllClosed will add exit_on_all_closed to Update.
ExitCondition::OnPrimaryClosed will add exit_on_primary_closed to Update.
close_when_requested: boolWhether to close windows when they are requested to be closed (i.e. when the close button is pressed).
If true, this plugin will add close_when_requested to Update.
If this system (or a replacement) is not running, the close button will have no effect.
This may surprise your users. It is recommended to leave this setting as true.
Trait Implementations§
Source§impl Default for WindowPlugin
impl Default for WindowPlugin
Source§impl Plugin for WindowPlugin
impl Plugin for WindowPlugin
Source§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
finish should be called.Source§fn finish(&self, _app: &mut App)
fn finish(&self, _app: &mut App)
App, once all plugins registered are ready. This can
be useful for plugins that depends on another plugin asynchronous setup, like the renderer.Source§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Auto Trait Implementations§
impl Freeze for WindowPlugin
impl RefUnwindSafe for WindowPlugin
impl Send for WindowPlugin
impl Sync for WindowPlugin
impl Unpin for WindowPlugin
impl UnwindSafe for WindowPlugin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more