Struct BackgroundControlValue

Source
pub struct BackgroundControlValue(/* private fields */);
Expand description

Lets you adjust how each background layer is displayed.

The effects of setting a BackgroundControlValue only apply in VideoMode 0, 1, and 2, and also the specific layer must be present in that video mode (eg: changing the BG0 control while in VideoMode2 has no effect).

  • priority: Determines the “z-order” of the background layers. When drawing a background pixel, the background layer with the lowest priority value non-transparent pixel gets its pixel drawn. If two BG layers have the same priority value set then the lower numbered background wins. Also note that the OBJ layer is part of this same calculation.
  • char_base_block: This determines the character base block for all tile ID offsets used by this background layer’s tile map.
  • mosaic: If this background layer should have the “mosaic” effect enabled.
  • bpp8: If the background should use use 8 bits per pixel (otherwise it uses 4 bits per pixel).
  • screen_base_block: Determines the tile map to use for arranging this background’s tiles.
  • affine_wrap: This causes the display area overflow to wrap when the layer is in affine mode, otherwise the display area is transparent. Has no effect on text mode backgrounds.
  • screen_size: This value affects the size of the background, but the details depend on if the background is in text mode or affine mode.
Screen SizeText Mode (px)Affine Mode (px)
0256^2128^2
1512x256 (wide)256^2
2256x512 (tall)512^2
3512^21024^2

Implementations§

Source§

impl BackgroundControlValue

Source

pub const fn new() -> Self

Source

pub const fn priority(self) -> u16

Source

pub const fn with_priority(self, u: u16) -> Self

Source

pub fn set_priority(&mut self, u: u16)

Source

pub const fn char_base_block(self) -> u16

Source

pub const fn with_char_base_block(self, u: u16) -> Self

Source

pub fn set_char_base_block(&mut self, u: u16)

Source

pub const fn mosaic(self) -> bool

Source

pub const fn with_mosaic(self, b: bool) -> Self

Source

pub fn set_mosaic(&mut self, b: bool)

Source

pub const fn bpp8(self) -> bool

Source

pub const fn with_bpp8(self, b: bool) -> Self

Source

pub fn set_bpp8(&mut self, b: bool)

Source

pub const fn screen_base_block(self) -> u16

Source

pub const fn with_screen_base_block(self, u: u16) -> Self

Source

pub fn set_screen_base_block(&mut self, u: u16)

Source

pub const fn affine_wrap(self) -> bool

Source

pub const fn with_affine_wrap(self, b: bool) -> Self

Source

pub fn set_affine_wrap(&mut self, b: bool)

Source

pub const fn screen_size(self) -> u16

Source

pub const fn with_screen_size(self, u: u16) -> Self

Source

pub fn set_screen_size(&mut self, u: u16)

Trait Implementations§

Source§

impl Clone for BackgroundControlValue

Source§

fn clone(&self) -> BackgroundControlValue

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BackgroundControlValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BackgroundControlValue

Source§

fn default() -> BackgroundControlValue

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

impl PartialEq for BackgroundControlValue

Source§

fn eq(&self, other: &BackgroundControlValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for BackgroundControlValue

Source§

impl Eq for BackgroundControlValue

Source§

impl StructuralPartialEq for BackgroundControlValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.