mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Rustdoc examples for OrthographicProjection (#11031)
Minimal working examples are helpful. Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
cf3105a0db
commit
9813e39f90
1 changed files with 25 additions and 0 deletions
|
@ -193,6 +193,19 @@ impl Default for PerspectiveProjection {
|
|||
}
|
||||
}
|
||||
|
||||
/// Scaling mode for [`OrthographicProjection`].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Configure the orthographic projection to two world units per window height:
|
||||
///
|
||||
/// ```
|
||||
/// # use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode};
|
||||
/// let projection = Projection::Orthographic(OrthographicProjection {
|
||||
/// scaling_mode: ScalingMode::FixedVertical(2.0),
|
||||
/// ..OrthographicProjection::default()
|
||||
/// });
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Copy, Reflect, Serialize, Deserialize)]
|
||||
#[reflect(Serialize, Deserialize)]
|
||||
pub enum ScalingMode {
|
||||
|
@ -278,6 +291,18 @@ impl DivAssign<f32> for ScalingMode {
|
|||
///
|
||||
/// Note that the scale of the projection and the apparent size of objects are inversely proportional.
|
||||
/// As the size of the projection increases, the size of objects decreases.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Configure the orthographic projection to one world unit per 100 window pixels:
|
||||
///
|
||||
/// ```
|
||||
/// # use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode};
|
||||
/// let projection = Projection::Orthographic(OrthographicProjection {
|
||||
/// scaling_mode: ScalingMode::WindowSize(100.0),
|
||||
/// ..OrthographicProjection::default()
|
||||
/// });
|
||||
/// ```
|
||||
#[derive(Component, Debug, Clone, Reflect)]
|
||||
#[reflect(Component, Default)]
|
||||
pub struct OrthographicProjection {
|
||||
|
|
Loading…
Reference in a new issue