2023-06-19 16:18:17 +00:00
|
|
|
use bevy_reflect::{prelude::ReflectDefault, FromReflect, Reflect, ReflectFromReflect};
|
2023-01-19 00:38:28 +00:00
|
|
|
|
|
|
|
#[cfg(feature = "serialize")]
|
|
|
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
|
|
|
|
Update and improve Window Documentation (#8858)
# Objective
Improve the documentation relating to windows, and update the parts that
have not been updated since version 0.8.
Version 0.9 introduced `Window` as a component, before that
`WindowDescriptor` (which would become `Window` later) was used to store
information about how a window will be created. Since version 0.9, from
my understanding, this information will also be synchronised with the
current state of the window, and can be used to modify this state.
However, some of the documentation has not been updated to reflect that,
here is an example:
https://docs.rs/bevy/0.8.0/bevy/window/enum.WindowMode.html /
https://docs.rs/bevy/latest/bevy/window/enum.WindowMode.html (notice
that the verb "Creates" is still there).
This PR aims at improving the documentation relating to windows.
## Solution
- Change "will" for "should" when relevant, "should" implies that the
information should in both direction (from the window state to the
`Window` component and vice-versa) and can be used to get and set, will
implies it is only used to set a state.
- Remove references to "creation" or be more clear about it.
- Reference back the `Window` component for most of its sub-structs.
- Clarify what needs to be clarified
- A lot of other minor changes, including fixing the link to W3schools
in `bevy_winit`
## Warning
Please note that my knowledge about how winit and bevy_winit work is
limited and some of the informations I added in the doc may be
inaccurate. A person who knows better how it works should review some of
my claims, in particular:
- How fullscreen works:
https://github.com/bevyengine/bevy/pull/8858#discussion_r1232413155
- How WindowResolution / sizes work:
https://github.com/bevyengine/bevy/pull/8858#discussion_r1233010719
- What happens when `WindowPosition` is set to `Centered` or
`Automatic`. From my understanding of the code, it should always be set
back to `At`, but is it really the case? For example [when creating the
window](https://github.com/bevyengine/bevy/blob/main/crates/bevy_winit/src/winit_windows.rs#L74),
or when [a `WindowEvent::Moved` is
triggered](https://github.com/bevyengine/bevy/blob/main/crates/bevy_winit/src/lib.rs#L602)
or when [Centered/Automatic by the code after the window is
created](https://github.com/bevyengine/bevy/blob/main/crates/bevy_winit/src/system.rs#L243),
am I missing some cases and do the codes I linked do that in all of
them?
- Are there any field in the `Window` component that can't be used to
modify the state of the window, only at creation?
---------
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Jerome Humbert <djeedai@gmail.com>
2023-06-22 03:00:40 +00:00
|
|
|
/// The icon to display for a [`Window`](crate::window::Window)'s [`Cursor`](crate::window::Cursor).
|
2022-06-16 13:20:37 +00:00
|
|
|
///
|
Update and improve Window Documentation (#8858)
# Objective
Improve the documentation relating to windows, and update the parts that
have not been updated since version 0.8.
Version 0.9 introduced `Window` as a component, before that
`WindowDescriptor` (which would become `Window` later) was used to store
information about how a window will be created. Since version 0.9, from
my understanding, this information will also be synchronised with the
current state of the window, and can be used to modify this state.
However, some of the documentation has not been updated to reflect that,
here is an example:
https://docs.rs/bevy/0.8.0/bevy/window/enum.WindowMode.html /
https://docs.rs/bevy/latest/bevy/window/enum.WindowMode.html (notice
that the verb "Creates" is still there).
This PR aims at improving the documentation relating to windows.
## Solution
- Change "will" for "should" when relevant, "should" implies that the
information should in both direction (from the window state to the
`Window` component and vice-versa) and can be used to get and set, will
implies it is only used to set a state.
- Remove references to "creation" or be more clear about it.
- Reference back the `Window` component for most of its sub-structs.
- Clarify what needs to be clarified
- A lot of other minor changes, including fixing the link to W3schools
in `bevy_winit`
## Warning
Please note that my knowledge about how winit and bevy_winit work is
limited and some of the informations I added in the doc may be
inaccurate. A person who knows better how it works should review some of
my claims, in particular:
- How fullscreen works:
https://github.com/bevyengine/bevy/pull/8858#discussion_r1232413155
- How WindowResolution / sizes work:
https://github.com/bevyengine/bevy/pull/8858#discussion_r1233010719
- What happens when `WindowPosition` is set to `Centered` or
`Automatic`. From my understanding of the code, it should always be set
back to `At`, but is it really the case? For example [when creating the
window](https://github.com/bevyengine/bevy/blob/main/crates/bevy_winit/src/winit_windows.rs#L74),
or when [a `WindowEvent::Moved` is
triggered](https://github.com/bevyengine/bevy/blob/main/crates/bevy_winit/src/lib.rs#L602)
or when [Centered/Automatic by the code after the window is
created](https://github.com/bevyengine/bevy/blob/main/crates/bevy_winit/src/system.rs#L243),
am I missing some cases and do the codes I linked do that in all of
them?
- Are there any field in the `Window` component that can't be used to
modify the state of the window, only at creation?
---------
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Jerome Humbert <djeedai@gmail.com>
2023-06-22 03:00:40 +00:00
|
|
|
/// Examples of all of these cursors can be found [here](https://www.w3schools.com/cssref/playit.php?filename=playcss_cursor&preval=crosshair).
|
2022-06-16 13:20:37 +00:00
|
|
|
/// This `enum` is simply a copy of a similar `enum` found in [`winit`](https://docs.rs/winit/latest/winit/window/enum.CursorIcon.html).
|
2022-07-21 20:46:54 +00:00
|
|
|
/// `winit`, in turn, mostly copied cursor types available in the browser.
|
2023-01-19 00:38:28 +00:00
|
|
|
#[derive(Default, Debug, Hash, PartialEq, Eq, Clone, Copy, Reflect, FromReflect)]
|
|
|
|
#[cfg_attr(
|
|
|
|
feature = "serialize",
|
|
|
|
derive(serde::Serialize, serde::Deserialize),
|
|
|
|
reflect(Serialize, Deserialize)
|
|
|
|
)]
|
2023-06-19 16:18:17 +00:00
|
|
|
#[reflect(Debug, PartialEq, Default, FromReflect)]
|
2021-12-20 22:04:45 +00:00
|
|
|
pub enum CursorIcon {
|
2022-06-16 13:20:37 +00:00
|
|
|
/// The platform-dependent default cursor.
|
2023-01-19 00:38:28 +00:00
|
|
|
#[default]
|
2021-12-20 22:04:45 +00:00
|
|
|
Default,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// A simple crosshair.
|
2021-12-20 22:04:45 +00:00
|
|
|
Crosshair,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// A hand (often used to indicate links in web browsers).
|
2021-12-20 22:04:45 +00:00
|
|
|
Hand,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// An arrow. This is the default cursor on most systems.
|
2021-12-20 22:04:45 +00:00
|
|
|
Arrow,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates something is to be moved.
|
2021-12-20 22:04:45 +00:00
|
|
|
Move,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates text that may be selected or edited.
|
2021-12-20 22:04:45 +00:00
|
|
|
Text,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Program busy indicator.
|
2021-12-20 22:04:45 +00:00
|
|
|
Wait,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Help indicator (often rendered as a "?")
|
2021-12-20 22:04:45 +00:00
|
|
|
Help,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Progress indicator. Shows that processing is being done.
|
|
|
|
///
|
|
|
|
/// But in contrast with "Wait" the user may still interact with the program.
|
|
|
|
/// Often rendered as a spinning beach ball, or an arrow with a watch or hourglass.
|
2021-12-20 22:04:45 +00:00
|
|
|
Progress,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Cursor showing that something cannot be done.
|
2021-12-20 22:04:45 +00:00
|
|
|
NotAllowed,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that a context menu is available.
|
2021-12-20 22:04:45 +00:00
|
|
|
ContextMenu,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that a cell (or set of cells) may be selected.
|
2021-12-20 22:04:45 +00:00
|
|
|
Cell,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates vertical text that may be selected or edited.
|
2021-12-20 22:04:45 +00:00
|
|
|
VerticalText,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that an alias of something is to be created.
|
2021-12-20 22:04:45 +00:00
|
|
|
Alias,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates something is to be copied.
|
2021-12-20 22:04:45 +00:00
|
|
|
Copy,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that the dragged item cannot be dropped here.
|
2021-12-20 22:04:45 +00:00
|
|
|
NoDrop,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that something can be grabbed.
|
2021-12-20 22:04:45 +00:00
|
|
|
Grab,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that something is grabbed.
|
2021-12-20 22:04:45 +00:00
|
|
|
Grabbing,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that the user can scroll by dragging the mouse.
|
2021-12-20 22:04:45 +00:00
|
|
|
AllScroll,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that the user can zoom in.
|
2021-12-20 22:04:45 +00:00
|
|
|
ZoomIn,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that the user can zoom out.
|
2021-12-20 22:04:45 +00:00
|
|
|
ZoomOut,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that an edge of a box is to be moved right (east).
|
2021-12-20 22:04:45 +00:00
|
|
|
EResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that an edge of a box is to be moved up (north).
|
2021-12-20 22:04:45 +00:00
|
|
|
NResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that an edge of a box is to be moved up and right (north/east).
|
2021-12-20 22:04:45 +00:00
|
|
|
NeResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// indicates that an edge of a box is to be moved up and left (north/west).
|
2021-12-20 22:04:45 +00:00
|
|
|
NwResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that an edge of a box is to be moved down (south).
|
2021-12-20 22:04:45 +00:00
|
|
|
SResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// The cursor indicates that an edge of a box is to be moved down and right (south/east).
|
2021-12-20 22:04:45 +00:00
|
|
|
SeResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// The cursor indicates that an edge of a box is to be moved down and left (south/west).
|
2021-12-20 22:04:45 +00:00
|
|
|
SwResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that an edge of a box is to be moved left (west).
|
2021-12-20 22:04:45 +00:00
|
|
|
WResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates a bidirectional resize cursor.
|
2021-12-20 22:04:45 +00:00
|
|
|
EwResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates a bidirectional resize cursor.
|
2021-12-20 22:04:45 +00:00
|
|
|
NsResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates a bidirectional resize cursor.
|
2021-12-20 22:04:45 +00:00
|
|
|
NeswResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates a bidirectional resize cursor.
|
2021-12-20 22:04:45 +00:00
|
|
|
NwseResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that a column can be resized horizontally.
|
2021-12-20 22:04:45 +00:00
|
|
|
ColResize,
|
2022-06-16 13:20:37 +00:00
|
|
|
/// Indicates that the row can be resized vertically.
|
2021-12-20 22:04:45 +00:00
|
|
|
RowResize,
|
|
|
|
}
|