mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
fix the combo rom
This commit is contained in:
parent
df716a9d9a
commit
4ad93d134e
|
@ -16,37 +16,14 @@ use agb::{
|
||||||
input::Button,
|
input::Button,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
type Game = fn(agb::Gba) -> !;
|
||||||
pub enum Game {
|
|
||||||
TheHatChoosesTheWizard,
|
|
||||||
ThePurpleNight,
|
|
||||||
HyperspaceRoll,
|
|
||||||
TheDungeonPuzzlersLament,
|
|
||||||
Amplitude,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Game {
|
const GAMES: &[Game] = &[
|
||||||
fn launch_game(self, gba: agb::Gba) -> ! {
|
the_hat_chooses_the_wizard::main,
|
||||||
match self {
|
the_purple_night::main,
|
||||||
Game::TheHatChoosesTheWizard => the_hat_chooses_the_wizard::main(gba),
|
the_dungeon_puzzlers_lament::entry,
|
||||||
Game::ThePurpleNight => the_purple_night::main(gba),
|
amplitude::main,
|
||||||
Game::HyperspaceRoll => hyperspace_roll::main(gba),
|
];
|
||||||
Game::TheDungeonPuzzlersLament => the_dungeon_puzzlers_lament::entry(gba),
|
|
||||||
Game::Amplitude => amplitude::main(gba),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn from_index(index: i32) -> Game {
|
|
||||||
match index.rem_euclid(4) {
|
|
||||||
0 => Game::TheHatChoosesTheWizard,
|
|
||||||
1 => Game::ThePurpleNight,
|
|
||||||
2 => Game::HyperspaceRoll,
|
|
||||||
3 => Game::TheDungeonPuzzlersLament,
|
|
||||||
4 => Game::Amplitude,
|
|
||||||
_ => unreachable!("game out of index in an unreachable manner"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include_background_gfx!(
|
include_background_gfx!(
|
||||||
games, "121105",
|
games, "121105",
|
||||||
|
@ -120,7 +97,7 @@ fn get_game(gba: &mut agb::Gba) -> Game {
|
||||||
input.update();
|
input.update();
|
||||||
|
|
||||||
if input.is_just_pressed(Button::A) {
|
if input.is_just_pressed(Button::A) {
|
||||||
break Game::from_index(game_idx);
|
break GAMES[game_idx.rem_euclid(GAMES.len() as i32) as usize];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,5 +109,5 @@ fn get_game(gba: &mut agb::Gba) -> Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main(mut gba: agb::Gba) -> ! {
|
pub fn main(mut gba: agb::Gba) -> ! {
|
||||||
get_game(&mut gba).launch_game(gba)
|
get_game(&mut gba)(gba)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue