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 copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

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

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

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Creates Self using data from the given [World]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.