mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 07:45:28 +00:00
remvove lock_display
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
extern crate alloc;
|
||||
use abi::{
|
||||
display::{Display, lock_display},
|
||||
display::Display,
|
||||
get_key,
|
||||
keyboard::{KeyCode, KeyState},
|
||||
print,
|
||||
@@ -58,8 +58,6 @@ pub fn main() {
|
||||
|
||||
loop {
|
||||
if dirty {
|
||||
lock_display(true);
|
||||
|
||||
let style = PrimitiveStyle::with_fill(Rgb565::BLACK);
|
||||
if let Some(area) = last_area {
|
||||
Rectangle::new(area.0.top_left, area.0.size)
|
||||
@@ -103,7 +101,6 @@ pub fn main() {
|
||||
eq_layout.draw(&mut display).unwrap();
|
||||
|
||||
dirty = false;
|
||||
lock_display(false);
|
||||
}
|
||||
|
||||
let event = get_key();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
extern crate alloc;
|
||||
use abi::{
|
||||
display::{Display, SCREEN_HEIGHT, SCREEN_WIDTH, lock_display},
|
||||
display::{Display, SCREEN_HEIGHT, SCREEN_WIDTH},
|
||||
fs::{list_dir, read_file},
|
||||
get_key,
|
||||
keyboard::{KeyCode, KeyState},
|
||||
@@ -70,7 +70,6 @@ pub fn main() {
|
||||
let x = cell_x + (cell_width - bmp_w) / 2;
|
||||
let y = cell_y + 5; // 5px top margin
|
||||
|
||||
lock_display(true);
|
||||
Image::new(&bmp, Point::new(x, y))
|
||||
.draw(&mut display)
|
||||
.unwrap();
|
||||
@@ -85,8 +84,6 @@ pub fn main() {
|
||||
.draw(&mut display)
|
||||
.unwrap();
|
||||
|
||||
lock_display(false);
|
||||
|
||||
images_drawn += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
extern crate alloc;
|
||||
use abi::{
|
||||
display::{Display, lock_display},
|
||||
display::Display,
|
||||
fs::{file_len, read_file},
|
||||
get_key, get_ms,
|
||||
keyboard::{KeyCode, KeyState},
|
||||
@@ -37,28 +37,24 @@ pub fn main() {
|
||||
|
||||
let gif = Gif::<Rgb565>::from_slice(&buf).unwrap();
|
||||
|
||||
// let mut frame_num = 0;
|
||||
let mut frame_num = 0;
|
||||
loop {
|
||||
for frame in gif.frames() {
|
||||
let start = get_ms();
|
||||
|
||||
// lock_display(true);
|
||||
frame.draw(&mut display).unwrap();
|
||||
// lock_display(false);
|
||||
|
||||
// frame_num += 1;
|
||||
frame_num += 1;
|
||||
|
||||
if frame_num % 100 == 0 {
|
||||
let event = get_key();
|
||||
if event.state != KeyState::Idle {
|
||||
match event.key {
|
||||
KeyCode::Esc => return,
|
||||
_ => (),
|
||||
};
|
||||
};
|
||||
}
|
||||
sleep(((frame.delay_centis as u64) * 10).saturating_sub(start));
|
||||
|
||||
// if frame_num % 100 == 0 {
|
||||
// let event = get_key();
|
||||
// if event.state != KeyState::Idle {
|
||||
// match event.key {
|
||||
// KeyCode::Esc => return,
|
||||
// _ => (),
|
||||
// };
|
||||
// };
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
extern crate alloc;
|
||||
use abi::{
|
||||
Rng,
|
||||
display::{Display, SCREEN_HEIGHT, SCREEN_WIDTH, lock_display},
|
||||
display::{Display, SCREEN_HEIGHT, SCREEN_WIDTH},
|
||||
get_key,
|
||||
keyboard::{KeyCode, KeyState},
|
||||
print, sleep,
|
||||
@@ -57,10 +57,8 @@ pub fn main() {
|
||||
};
|
||||
|
||||
// ensure all draws show up at once
|
||||
lock_display(true);
|
||||
game.pre_draw(&mut display);
|
||||
game.draw(&mut display);
|
||||
lock_display(false);
|
||||
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user