minor tweaks to improve the rendering of the bouncyball

This commit is contained in:
bunnie 2020-11-23 03:49:09 +08:00
parent 2d5bd20c16
commit a2670a7537
2 changed files with 3 additions and 5 deletions

View file

@ -66,7 +66,7 @@ fn xmain() -> ! {
} }
Opcode::Circle(mid, radius) => { Opcode::Circle(mid, radius) => {
info!("GFX: Drawing cicrle at {:?} radius {:?}", mid, radius); info!("GFX: Drawing cicrle at {:?} radius {:?}", mid, radius);
op::circle(display.native_buffer(), mid.x as _, mid.y as _, radius as _, 1, op::PixelColor::On); op::circle(display.native_buffer(), mid.x as _, mid.y as _, radius as _, 0, op::PixelColor::On);
} }
Opcode::Style(stroke_width, stroke_color, fill_color) => { Opcode::Style(stroke_width, stroke_color, fill_color) => {
current_color = stroke_color; current_color = stroke_color;

View file

@ -128,7 +128,6 @@ impl Bounce {
fn shell_main() -> ! { fn shell_main() -> ! {
timer::init(); timer::init();
log_server::init_wait().unwrap(); log_server::init_wait().unwrap();
let mut loops = 0;
// let log_server_id = xous::SID::from_bytes(b"xous-logs-output").unwrap(); // let log_server_id = xous::SID::from_bytes(b"xous-logs-output").unwrap();
let graphics_server_id = xous::SID::from_bytes(b"graphics-server ").unwrap(); let graphics_server_id = xous::SID::from_bytes(b"graphics-server ").unwrap();
@ -227,14 +226,13 @@ fn shell_main() -> ! {
info!("drawing string: {}", string_buffer); info!("drawing string: {}", string_buffer);
graphics_server::draw_string(graphics_conn, &string_buffer).expect("unable to draw string"); graphics_server::draw_string(graphics_conn, &string_buffer).expect("unable to draw string");
//ticktimer_server::sleep_ms(ticktimer_conn, 2000 + loops).expect("couldn't sleep"); ticktimer_server::sleep_ms(ticktimer_conn, 2000).expect("couldn't sleep");
loops += 1;
// draw the ball // draw the ball
bouncyball.update(); bouncyball.update();
graphics_server::clear_region(graphics_conn, graphics_server::clear_region(graphics_conn,
bouncyball.bounds.top_left().x as _, bouncyball.bounds.top_left().y as _, bouncyball.bounds.top_left().x as _, bouncyball.bounds.top_left().y as _,
bouncyball.bounds.bottom_right().x as _, bouncyball.bounds.bottom_right().y as _) bouncyball.bounds.bottom_right().x as _, bouncyball.bounds.bottom_right().y as usize + 1)
.expect("unable to clear region"); .expect("unable to clear region");
graphics_server::draw_circle( graphics_server::draw_circle(
graphics_conn, graphics_conn,