Struct bevy_retrograde_core::components::Camera [−][src]
pub struct Camera { pub size: CameraSize, pub centered: bool, pub background_color: Color, pub letterbox_color: Color, pub pixel_aspect_ratio: f32, pub custom_shader: Option<String>, }
Expand description
The camera component
Fields
size: CameraSize
The size of the camera along the fixed axis, which is by default the vertical axis
centered: bool
Whether the camera should be centered about it’s position. Defaults to true
. If set to
false false
, the top-left corner of the camera will be at its [Transform
].
background_color: Color
The background color of the camera
This is the color that will be scene in the viewport when there are no sprites in the game area.
letterbox_color: Color
The color of the letter box
The letter box is only visible when the camera size is set to LetterBoxed
.
pixel_aspect_ratio: f32
The aspect ratio of the pxiels when rendered through this camera
custom_shader: Option<String>
Additional shader code that will be added to the camera rendering that can be used for post-processing
This must be a OpenGL ES Shading Language 1.0 string.
// Spawn the camera commands.spawn().insert_bundle(CameraBundle { camera: Camera { // Set our camera to have a fixed height and an auto-resized width size: CameraSize::FixedHeight(100), background_color: Color::new(0.2, 0.2, 0.2, 1.0), custom_shader: Some( CrtShader { // You can configure shader options here ..Default::default() } .get_shader(), ), ..Default::default() }, ..Default::default() });
Implementations
Get the size in game pixels ( retro-sized, not screen pixels ) of the camera view
Trait Implementations
Returns a serializable value, if serialization is supported. Otherwise None
will be
returned. Read more
Returns a hash of the value (which includes the type) if hashing is supported. Otherwise
None
will be returned. Read more
Returns a “partial equal” comparison result if comparison is supported. Otherwise None
will be returned. Read more
Auto Trait Implementations
impl RefUnwindSafe for Camera
impl UnwindSafe for Camera
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
pub fn from_world(_world: &mut World) -> T
pub fn from_world(_world: &mut World) -> T
Creates Self
using data from the given [World]
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
pub fn vzip(self) -> V