use games::*;

fn main() {
    App::new()
        .add_plugins((BaseGamePlugin {
            name: "2d game example".into(),
            game_type: GameType::Two,
            ..default()
        },))
        .add_systems(Startup, spawn_guy)
        .run();
}

fn spawn_guy(
    mut commands: Commands,
    server: Res<AssetServer>,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    let material = MeshMaterial2d(materials.add(ColorMaterial {
        texture: Some(server.load("flappy/bevy.png")),
        ..default()
    }));

    let mesh = Mesh2d(meshes.add(Rectangle::new(100.0, 100.0)));

    let name = Name::new("lil guy");

    let t = Transform::from_xyz(0.0, 0.0, 0.0);

    commands.spawn((name, material, mesh, t));
}
