fix camera
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2637,7 +2637,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minesweeper"
|
name = "minesweeper"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bevy",
|
"bevy",
|
||||||
"bevy_ecs_tilemap",
|
"bevy_ecs_tilemap",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "minesweeper"
|
name = "minesweeper"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# Enable max optimizations for dependencies, but not for our code:
|
# Enable max optimizations for dependencies, but not for our code:
|
||||||
|
@@ -40,6 +40,9 @@ fn setup_camera(mut commands: Commands) {
|
|||||||
z: 1.0,
|
z: 1.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let offset_x = (translation.x / 16.0) as isize;
|
||||||
|
let offset_y = (translation.y / 16.0) as isize;
|
||||||
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera2dBundle {
|
Camera2dBundle {
|
||||||
projection: OrthographicProjection {
|
projection: OrthographicProjection {
|
||||||
@@ -53,14 +56,14 @@ fn setup_camera(mut commands: Commands) {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
transform: Transform {
|
transform: Transform {
|
||||||
translation,
|
translation: (translation % 16.0),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
TileOffset {
|
TileOffset {
|
||||||
x: 0,
|
x: offset_x,
|
||||||
y: 0,
|
y: offset_y,
|
||||||
translation,
|
translation,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user