[−][src]Struct rubidium::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]
Trait Implementations
impl Clone for Mode4
[src]
fn clone(&self) -> Mode4
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Mode4
[src]
impl Debug for Mode4
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,