Compare commits
2 Commits
26cf4c7453
...
f17917ecad
Author | SHA1 | Date |
---|---|---|
Zynh Ludwig | f17917ecad | |
Zynh Ludwig | dfc012d370 |
13
src/main.rs
13
src/main.rs
|
@ -60,16 +60,9 @@ fn main() {
|
||||||
.insert_resource(WinitSettings::desktop_app())
|
.insert_resource(WinitSettings::desktop_app())
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, rotate_board)
|
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rotate_board(mut board: Query<&mut Transform, With<Board>>) {
|
|
||||||
let mut board = board.get_single_mut().unwrap();
|
|
||||||
|
|
||||||
board.rotate_local_z(0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
struct Board;
|
struct Board;
|
||||||
|
|
||||||
|
@ -81,8 +74,8 @@ fn setup(
|
||||||
commands.spawn(Camera2dBundle::default());
|
commands.spawn(Camera2dBundle::default());
|
||||||
|
|
||||||
const TILES: i32 = 9;
|
const TILES: i32 = 9;
|
||||||
const TILE_SIZE: f32 = 50.;
|
const TILE_SIZE: f32 = 5.;
|
||||||
const GAP_SIZE: f32 = 10.;
|
const GAP_SIZE: f32 = 1.;
|
||||||
const TOTAL_WIDTH: f32 = (TILE_SIZE + GAP_SIZE) * TILES as f32;
|
const TOTAL_WIDTH: f32 = (TILE_SIZE + GAP_SIZE) * TILES as f32;
|
||||||
const TILE_SPACE: f32 = TOTAL_WIDTH / TILES as f32;
|
const TILE_SPACE: f32 = TOTAL_WIDTH / TILES as f32;
|
||||||
const OFFSET: f32 = TILE_SPACE / 2.;
|
const OFFSET: f32 = TILE_SPACE / 2.;
|
||||||
|
@ -94,7 +87,7 @@ fn setup(
|
||||||
commands
|
commands
|
||||||
.spawn((
|
.spawn((
|
||||||
SpatialBundle {
|
SpatialBundle {
|
||||||
transform: Transform::from_xyz(0., 0., 0.),
|
transform: Transform::from_xyz(0., 0., 0.).with_scale(Vec3::splat(10.)),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
Board,
|
Board,
|
||||||
|
|
Loading…
Reference in New Issue