agb/examples/panic.rs

27 lines
644 B
Rust
Raw Normal View History

2021-03-06 17:58:59 +00:00
#![no_std]
#![feature(start)]
extern crate gba;
use gba::display;
#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
let mut gba = gba::Gba::new();
2021-03-06 17:58:59 +00:00
2021-03-08 03:48:13 +00:00
let mut bitmap = gba.display.video.bitmap3();
2021-03-06 17:58:59 +00:00
let mut input = gba::input::ButtonController::new();
loop {
input.update();
2021-03-06 20:09:23 +00:00
// if A is pressed, draw out of range
2021-03-06 17:58:59 +00:00
if input.is_just_pressed(gba::input::Button::A) {
bitmap.draw_point(display::WIDTH, 0, 0x05);
}
2021-03-09 00:10:14 +00:00
if input.is_just_pressed(gba::input::Button::B) {
#[allow(arithmetic_overflow)]
2021-04-11 16:34:50 +01:00
let _p = core::i32::MAX + 1;
2021-03-09 00:10:14 +00:00
}
2021-03-06 17:58:59 +00:00
}
}