Enum Command

Source
pub enum Command {
    MemoryPreset {
        color: u8,
        repeat: u8,
    },
    BorderPreset {
        color: u8,
    },
    TileNormal {
        tile: Tile,
    },
    TileXOR {
        tile: Tile,
    },
    Scroll {
        color: Option<u8>,
        cmd: (ScrollCommand, ScrollCommand),
        offset: (u8, u8),
    },
    SetTransparent {
        color: u8,
    },
    LoadPalette {
        offset: u8,
        clut: [RgbColor; 8],
    },
}
Expand description

One drawing command

Variants§

§

MemoryPreset

Clear the scren to color. This command will usually appear multiple times in a row with repeat incrementing each time, starting at 0. If you trust your CDG to be without errors, you can therefore ignore MemoryPreset commands with a nonzero repeat value

Fields

§color: u8
§repeat: u8
§

BorderPreset

Clear the border region to color. Documents vary as to whether the border region is the outside tile or the outside half-tile.

Fields

§color: u8
§

TileNormal

Draw a tile normally

Fields

§tile: Tile
§

TileXOR

Draw a tile by XORing the color indices in the tile with the colors indices already drawn. Note that this does not operate on RGB values.

Fields

§tile: Tile
§

Scroll

Scroll the screen by the given horizontal and vertical amount, respectively. offset is given as an absolute position within the first tile to begin scanout.

If color is none, the tiles scrolled off one side of the framebuffer should be copied to the other side. Otherwise, they should be filled in with color

Fields

§color: Option<u8>
§offset: (u8, u8)
§

SetTransparent

Set one element of the CLUT to transparent, to enable background video/images

Fields

§color: u8
§

LoadPalette

Load one half of the CLUT. offset will be either 0 or 8, depending on whether the bottom or top half of the CLUT is to be loaded.

These changes take effect immediately, so this can be used to implement color cycling.

Fields

§offset: u8
§clut: [RgbColor; 8]

Trait Implementations§

Source§

impl Debug for Command

Source§

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

Formats the value using the given formatter. Read more

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> 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.