ScalingMode
WindowSize
Fixed
- width : f32
- height : f32
AutoMin
- min_width : f32
- min_height : f32
AutoMax
- max_width : f32
- max_height : f32
FixedVertical
- viewport_height : f32
FixedHorizontal
- viewport_width : f32
Description
Scaling mode for [
OrthographicProjection
].The effect of these scaling modes are combined with the [
OrthographicProjection::scale
] property.For example, if the scaling mode is
ScalingMode::Fixed { width: 100.0, height: 300 }
and the scale is2.0
, the projection will be 200 world units wide and 600 world units tall.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 { viewport_height: 2.0 }, ..OrthographicProjection::default_2d() });