agb/examples/panic.rs

27 lines
644 B
Rust
Raw Normal View History

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