agb/examples/bitmap4.rs

40 lines
803 B
Rust
Raw Normal View History

2021-03-07 04:58:59 +11:00
#![no_std]
#![feature(start)]
2021-04-16 07:10:00 +10:00
extern crate agb;
2021-03-07 04:58:59 +11:00
2021-04-16 07:10:00 +10:00
use agb::display;
2021-03-07 04:58:59 +11:00
#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
2021-04-16 07:10:00 +10:00
let mut gba = agb::Gba::new();
let mut bitmap = gba.display.video.bitmap4();
let vblank = gba.display.vblank.get();
2021-03-07 04:58:59 +11:00
bitmap.set_palette_entry(1, 0x001F);
bitmap.set_palette_entry(2, 0x03E0);
bitmap.draw_point_page(
display::WIDTH / 2,
display::HEIGHT / 2,
1,
2021-03-07 11:47:39 +11:00
display::bitmap4::Page::Front,
2021-03-07 04:58:59 +11:00
);
bitmap.draw_point_page(
display::WIDTH / 2 + 5,
display::HEIGHT / 2,
2,
2021-03-07 11:47:39 +11:00
display::bitmap4::Page::Back,
2021-03-07 04:58:59 +11:00
);
let mut count = 0;
loop {
2021-03-07 11:47:39 +11:00
vblank.wait_for_VBlank();
2021-03-07 04:58:59 +11:00
count += 1;
if count % 6 == 0 {
bitmap.flip_page();
}
}
}