Use the fact that tris turn into integers nicely

This commit is contained in:
Gwilym Kuiper 2022-10-01 15:29:42 +01:00
parent 63b0fa63c6
commit dd2030d354

View file

@ -43,18 +43,8 @@ fn main(mut gba: agb::Gba) -> ! {
loop { loop {
input.update(); input.update();
scroll_x += input.x_tri() as i32;
match input.x_tri() { scroll_y += input.y_tri() as i32;
Tri::Positive => scroll_x += 1,
Tri::Negative => scroll_x -= 1,
_ => {}
}
match input.y_tri() {
Tri::Positive => scroll_y += 1,
Tri::Negative => scroll_y -= 1,
_ => {}
}
let scroll_pos = (scroll_x as i16, scroll_y as i16); let scroll_pos = (scroll_x as i16, scroll_y as i16);
bg.set_scroll_pos(scroll_pos.into()); bg.set_scroll_pos(scroll_pos.into());