()
| 327 | const CR: u8 = 0x0du8; |
| 328 | #[no_mangle] |
| 329 | pub fn main() -> i32 { |
| 330 | let mut disp = Display::new(Size::new(VIRTGPU_XRES, VIRTGPU_YRES)); |
| 331 | let mut game = SnakeGame::<20, Rgb888>::new(1280, 800, 20, 20, Rgb888::RED, Rgb888::YELLOW, 50); |
| 332 | let _ = disp.clear(Rgb888::BLACK).unwrap(); |
| 333 | loop { |
| 334 | if key_pressed() { |
| 335 | let c = getchar(); |
| 336 | match c { |
| 337 | LF => break, |
| 338 | CR => break, |
| 339 | b'w' => game.set_direction(Direction::Up), |
| 340 | b's' => game.set_direction(Direction::Down), |
| 341 | b'a' => game.set_direction(Direction::Left), |
| 342 | b'd' => game.set_direction(Direction::Right), |
| 343 | _ => (), |
| 344 | } |
| 345 | } |
| 346 | let _ = disp.clear(Rgb888::BLACK).unwrap(); |
| 347 | game.draw(&mut disp); |
| 348 | sleep(10); |
| 349 | } |
| 350 | 0 |
| 351 | } |
nothing calls this directly
no test coverage detected