#[non_exhaustive]pub struct Bitmap4<'gba> { /* private fields */ }
Implementations§
source§impl Bitmap4<'_>
impl Bitmap4<'_>
sourcepub fn draw_point_page(&mut self, x: i32, y: i32, colour: u8, page: Page)
pub fn draw_point_page(&mut self, x: i32, y: i32, colour: u8, page: Page)
Draws point on specified page at (x, y) coordinates with colour index whose colour is specified in the background palette. Panics if (x, y) is out of the bounds of the screen.
Examples found in repository?
examples/multiple_video.rs (lines 57-62)
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
fn bitmap4_mode(
bitmap: &mut display::bitmap4::Bitmap4,
vblank: &agb::interrupt::VBlank,
input: &mut agb::input::ButtonController,
) {
bitmap.set_palette_entry(1, 0x001F);
bitmap.set_palette_entry(2, 0x03E0);
bitmap.draw_point_page(
display::WIDTH / 2,
display::HEIGHT / 2,
1,
display::bitmap4::Page::Front,
);
bitmap.draw_point_page(
display::WIDTH / 2 + 5,
display::HEIGHT / 2,
2,
display::bitmap4::Page::Back,
);
let mut count = 0;
loop {
vblank.wait_for_vblank();
input.update();
if input.is_just_pressed(agb::input::Button::B) {
break;
}
count += 1;
if count % 6 == 0 {
bitmap.flip_page();
}
}
}
sourcepub fn draw_point(&mut self, x: i32, y: i32, colour: u8)
pub fn draw_point(&mut self, x: i32, y: i32, colour: u8)
Draws point on the non-current page at (x, y) coordinates with colour index whose colour is specified in the background palette. Panics if (x, y) is out of the bounds of the screen.
sourcepub fn set_palette_entry(&mut self, entry: u32, colour: u16)
pub fn set_palette_entry(&mut self, entry: u32, colour: u16)
Sets the colour of colour index in the background palette.
Examples found in repository?
examples/multiple_video.rs (line 54)
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
fn bitmap4_mode(
bitmap: &mut display::bitmap4::Bitmap4,
vblank: &agb::interrupt::VBlank,
input: &mut agb::input::ButtonController,
) {
bitmap.set_palette_entry(1, 0x001F);
bitmap.set_palette_entry(2, 0x03E0);
bitmap.draw_point_page(
display::WIDTH / 2,
display::HEIGHT / 2,
1,
display::bitmap4::Page::Front,
);
bitmap.draw_point_page(
display::WIDTH / 2 + 5,
display::HEIGHT / 2,
2,
display::bitmap4::Page::Back,
);
let mut count = 0;
loop {
vblank.wait_for_vblank();
input.update();
if input.is_just_pressed(agb::input::Button::B) {
break;
}
count += 1;
if count % 6 == 0 {
bitmap.flip_page();
}
}
}
sourcepub fn flip_page(&mut self)
pub fn flip_page(&mut self)
Flips page, changing the Gameboy advance to draw the contents of the other page
Examples found in repository?
examples/multiple_video.rs (line 81)
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
fn bitmap4_mode(
bitmap: &mut display::bitmap4::Bitmap4,
vblank: &agb::interrupt::VBlank,
input: &mut agb::input::ButtonController,
) {
bitmap.set_palette_entry(1, 0x001F);
bitmap.set_palette_entry(2, 0x03E0);
bitmap.draw_point_page(
display::WIDTH / 2,
display::HEIGHT / 2,
1,
display::bitmap4::Page::Front,
);
bitmap.draw_point_page(
display::WIDTH / 2 + 5,
display::HEIGHT / 2,
2,
display::bitmap4::Page::Back,
);
let mut count = 0;
loop {
vblank.wait_for_vblank();
input.update();
if input.is_just_pressed(agb::input::Button::B) {
break;
}
count += 1;
if count % 6 == 0 {
bitmap.flip_page();
}
}
}