DEV Community

Cover image for Bevy Minesweeper: Tile Map Generation

Bevy Minesweeper: Tile Map Generation

Qongzi on February 21, 2022

Check the repository Let's generate the minesweeper base tile map and set up our plugin. Create a components module with a coordinates.rs file...
Collapse
 
bmbenson profile image
Bryan Benson • Edited

With bevy 0.10.0 & egui 0.18.1

\\coordinates.rs
<...>
use bevy::reflect::Reflect;
#[cfg(feature = "debug")]
use bevy_inspector_egui::prelude::ReflectInspectorOptions;
#[cfg(feature = "debug")]
use bevy_inspector_egui::InspectorOptions;

#[cfg_attr(feature = "debug", derive(Reflect, InspectorOptions))]
#[cfg_attr(feature = "debug", reflect(InspectorOptions))]
#[derive(Debug, Default, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Component)]
pub struct Coordinates {
    pub x: u16,
    pub y: u16,
}
<...>


\\ main.rs
<...>
//After: app.add_plugin(BoardPlugin);
app.register_type::<Coordinates>();
<...>


Enter fullscreen mode Exit fullscreen mode
Collapse
 
dan_ profile image
Dan • Edited

bevy_inspector_egui::Inspectable is not supported in recent versions of bevy_inspector_egui.
Can use bevy::prelude::Reflect with bevy_inspector_egui::InspectorOptions to replace.
how to use
don't forget to register custom type in app by using app.register_type<Type>()

Collapse
 
leonidv profile image
Leonid Vygovskiy

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