Compare commits
No commits in common. "00e5bab2a56c5d47f34140aa9ea4561a559d3a0c" and "282964a0f0dfa102bbfe506aa9fb37008b5d9ca3" have entirely different histories.
00e5bab2a5
...
282964a0f0
|
@ -2,7 +2,4 @@
|
||||||
rustflags = [
|
rustflags = [
|
||||||
# (Nightly) Make the current crate share its generic instantiations
|
# (Nightly) Make the current crate share its generic instantiations
|
||||||
"-Zshare-generics=y",
|
"-Zshare-generics=y",
|
||||||
"-C",
|
|
||||||
"link-arg=-fuse-ld=mold",
|
|
||||||
]
|
]
|
||||||
linker = "clang"
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ with pkgs;
|
||||||
mkShell rec {
|
mkShell rec {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkg-config
|
pkg-config
|
||||||
mold
|
|
||||||
clang
|
|
||||||
];
|
];
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
udev
|
udev
|
||||||
|
|
27
src/main.rs
27
src/main.rs
|
@ -1,8 +1,6 @@
|
||||||
use bevy::{
|
use bevy::{
|
||||||
color::palettes::tailwind,
|
|
||||||
prelude::*,
|
prelude::*,
|
||||||
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
||||||
winit::WinitSettings,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// In a vacuum this is just 2, 2 dimenionsal arrays, but I think
|
// In a vacuum this is just 2, 2 dimenionsal arrays, but I think
|
||||||
|
@ -57,7 +55,6 @@ use bevy::{
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.insert_resource(WinitSettings::desktop_app())
|
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.run();
|
.run();
|
||||||
|
@ -70,27 +67,13 @@ fn setup(
|
||||||
) {
|
) {
|
||||||
commands.spawn(Camera2dBundle::default());
|
commands.spawn(Camera2dBundle::default());
|
||||||
|
|
||||||
const TILES: i32 = 9;
|
let circle_mesh = Mesh2dHandle(meshes.add(Circle { radius: 50. }));
|
||||||
const TILE_SIZE: f32 = 50.;
|
let color = Color::hsl(75., 0.95, 0.7);
|
||||||
const GAP_SIZE: f32 = 10.;
|
|
||||||
const OFFSET: f32 = (TILE_SIZE + GAP_SIZE) / 2.;
|
|
||||||
const TOTAL_WIDTH: f32 = (TILE_SIZE + GAP_SIZE) * TILES as f32;
|
|
||||||
const TILE_SPACE: f32 = TOTAL_WIDTH / TILES as f32;
|
|
||||||
const CENTER: f32 = TOTAL_WIDTH / 2.;
|
|
||||||
|
|
||||||
let tile_mesh = Mesh2dHandle(meshes.add(Rectangle::new(TILE_SIZE, TILE_SIZE)));
|
|
||||||
let tile_color = Color::from(tailwind::NEUTRAL_700);
|
|
||||||
|
|
||||||
for i in 0..TILES {
|
|
||||||
for j in 0..TILES {
|
|
||||||
let tile_x = i as f32 * TILE_SPACE - CENTER + OFFSET;
|
|
||||||
let tile_y = j as f32 * TILE_SPACE - CENTER + OFFSET;
|
|
||||||
commands.spawn(MaterialMesh2dBundle {
|
commands.spawn(MaterialMesh2dBundle {
|
||||||
mesh: tile_mesh.clone(),
|
mesh: circle_mesh,
|
||||||
material: materials.add(tile_color),
|
material: materials.add(color),
|
||||||
transform: Transform::from_xyz(tile_x, tile_y, 0.),
|
transform: Transform::from_xyz(0., 0., 0.),
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue