fn handle_key_presses(mut game_mode: UniqueViewMut<GameModeInfo>,
                      mut player:UniqueViewMut<Boat>,) -> Result<(), GameOver>
{
    if is_key_pressed(KeyCode::D){
        if game_mode.game_mode == GameMode::Debug{
            game_mode.game_mode = GameMode::Default
        }else{
            game_mode.game_mode = GameMode::Debug
        }
    }
    if is_key_down(KeyCode::Left) {
        player.turn(-0.1);
    } else if is_key_down(KeyCode::Right) {
        player.turn(0.1);
    }
    if is_key_down(KeyCode::Up) {
        player.thrust();
    }
    if is_key_down(KeyCode::Space) {
        // shoot something forward
    }

    if is_key_pressed(KeyCode::Escape){
        // somehow this wasn't making it out to run... 
        // Err(GameOver::Score(100))
        // so just hard exit here
        process::exit(0);
    } else {
        Ok(())
    }
}
// handle key presses for game mode changes
handle key presses for game mode changes
handle key presses for game mode changes
fn handle_key_presses(mut game_mode: UniqueViewMut<GameModeInfo>,
                      mut player:UniqueViewMut<Boat>,) -> Result<(), GameOver>
{
    if is_key_pressed(KeyCode::D){
        if game_mode.game_mode == GameMode::Debug{
            game_mode.game_mode = GameMode::Default
        }else{
            game_mode.game_mode = GameMode::Debug
        }
    }
    if is_key_down(KeyCode::Left) {
        player.turn(-0.1);
    } else if is_key_down(KeyCode::Right) {
        player.turn(0.1);
    }
    if is_key_down(KeyCode::Up) {
        player.thrust();
    }
    if is_key_down(KeyCode::Space) {
        // shoot something forward
    }
    if is_key_pressed(KeyCode::Escape){
        // somehow this wasn't making it out to run... 
        // Err(GameOver::Score(100))
        // so just hard exit here
        process::exit(0);
    } else {
        Ok(())
    }
}
fn handle_key_presses ( mut game_mode : UniqueViewMut < GameModeInfo > , mut player : UniqueViewMut < Boat > , ) -> Result < ( ) , GameOver > { if is_key_pressed ( KeyCode :: D ) { if game_mode . game_mode == GameMode :: Debug { game_mode . game_mode = GameMode :: Default } else { game_mode . game_mode = GameMode :: Debug } } if is_key_down ( KeyCode :: Left ) { player . turn ( - 0.1 ) ; } else if is_key_down ( KeyCode :: Right ) { player . turn ( 0.1 ) ; } if is_key_down ( KeyCode :: Up ) { player . thrust ( ) ; } if is_key_down ( KeyCode :: Space ) { // shoot something forward } if is_key_pressed ( KeyCode :: Escape ) { // somehow this wasn't making it out to run...  // Err(GameOver::Score(100)) // so just hard exit here process :: exit ( 0 ) ; } else { Ok ( ( ) ) } }
handle key presses for game mode changes
handle key presses for game mode changes
game_mode
UniqueViewMut<GameModeInfo>
player
UniqueViewMut<Boat>
game_mode
UniqueViewMut<GameModeInfo>
player
UniqueViewMut<Boat>