[][src]Struct rubidium::Mode4

pub struct Mode4;

A ZST for namespacing VideoMode4 stuff into one place.

In Mode 4 the majority of VRAM is occupied with two "indexmaps", frame 0 and frame 1, each as large as the GBA's physical display.

Each position in a frame contains a u8 index value into the PALRAM, which contains the actual color value that will be displayed at that location of the frame. As with most other indexed color on the GBA, index 0 is "transparent".

You can access the address of a location by row and then col or by x and then y. It will give equivalent results.

There is a complication with this. You can't write just a single u8 to VRAM. If you write a single u8, that byte gets written to both the low byte and the high byte of the u16 that the byte is inside of. In other words, if you write a byte to rc(0,0), you also would write the same value to rc(0,1) as well. The only way to edit a single location in Mode4 is to read in the current value of a pair of locations, change just the byte you want to change, and then write back the data.

let p = Mode4.frame(1).row(8).col(5);
let q = Mode4.frame(1).x(5).y(8);
assert_eq!(p, q);

See Also: VideoMode

Methods

impl Mode4[src]

pub const WIDTH: usize[src]

In Mode4 each frame is 240 wide.

pub const HEIGHT: usize[src]

In Mode4 each frame is 160 wide.

#[must_use]pub fn frame(self, frame: usize) -> Mode4Frame[src]

Selects frame 0 or frame 1.

Panics

If the input is greater than 1.

Trait Implementations

impl Clone for Mode4[src]

impl Copy for Mode4[src]

impl Debug for Mode4[src]

Auto Trait Implementations

impl Send for Mode4

impl Sync for Mode4

impl Unpin for Mode4

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.