DEV Community

Cover image for Bevy Minesweeper: Project Setup

Bevy Minesweeper: Project Setup

Qongzi on February 21, 2022

Check the repository One of the purposes of this tutorial is to create a generic plugin that can be embedded in any app. To do this we will init...
Collapse
 
changhe3 profile image
Chang He

Update for 0.8:
OrthographicCameraBundle::new_2d() becomes Camera2dBundle::default()

Collapse
 
bmbenson profile image
Bryan Benson

For Bevy 0.10.0:

use bevy::prelude::*;
use bevy::window::WindowResolution;

#[cfg(feature = "debug")]
use bevy_inspector_egui::quick::WorldInspectorPlugin;

fn main() {
    let mut app = App::new();
    // Add default plugins and do Window setup
    app.add_plugins(DefaultPlugins.set(WindowPlugin {
        primary_window: Some(Window {
            resolution: WindowResolution::new(700.0, 800.0),
            title: "Mine Sweeper!".to_string(),
            ..default()
        }),
        ..default()
    }));
    #[cfg(feature = "debug")]
    // Debug hierarchy inspector
    app.add_plugin(WorldInspectorPlugin::new());
    // Startup system (cameras)
    app.add_startup_system(camera_setup);
    // Run the app
    app.run();
}

fn camera_setup(mut commands: Commands) {
    // 2D orthographic camera
    commands.spawn(Camera2dBundle::default());
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
leonidv profile image
Leonid Vygovskiy • Edited

github.com/leonidv/bevy-minesweepe... - full tutorial updated to 12.1. One chapter per commit.