fix bug in impl Drop for FrameTracker, for the correctly mapping/unmapping display buffer in app

This commit is contained in:
Yu Chen 2023-01-10 16:29:36 +08:00
parent 2cbd237260
commit 73fcb72cbb
6 changed files with 16 additions and 5 deletions

View file

@ -108,6 +108,7 @@ impl DrawingBoard {
pub fn main() -> i32 {
// let fb_ptr = framebuffer() as *mut u8;
let mut board = DrawingBoard::new();
let _ = board.disp.clear(Rgb888::BLACK).unwrap();
for i in 0..20 {
board.latest_pos.x += i;
board.latest_pos.y += i;

View file

@ -382,6 +382,7 @@ const CR: u8 = 0x0du8;
pub fn main() -> i32 {
let mut disp = Display::new(Size::new(1280, 800), Point::new(0, 0));
let mut game = SnakeGame::<20, Rgb888>::new(1280, 800, 20, 20, Rgb888::RED, Rgb888::YELLOW, 50);
let _ = disp.clear(Rgb888::BLACK).unwrap();
loop {
if key_pressed() {
let c = getchar();

View file

@ -111,6 +111,7 @@ const CR: u8 = 0x0du8;
pub fn main() -> i32 {
// let fb_ptr = framebuffer() as *mut u8;
let mut board = DrawingBoard::new();
let _ = board.disp.clear(Rgb888::BLACK).unwrap();
for i in 0..20 {
let c=getchar();
if c == LF || c == CR {