Merge branch 'main' into new-menu
Some checks failed
Rust Checks / checks (push) Failing after 6s

This commit is contained in:
raphael 2024-04-01 16:29:57 +02:00
commit ed49d489b4
2 changed files with 6 additions and 6 deletions

View file

@ -107,7 +107,7 @@ fn keyboard_movement_system(
/// Moves the camera with mouse input.
fn mouse_movement_system(
mouse_button_input: Res<Input<MouseButton>>,
mut query: Query<&mut Transform, With<Camera>>,
mut query: Query<(&mut Transform, &OrthographicProjection), With<Camera>>,
windows: Query<&Window>,
mut last_position: Local<Option<Vec2>>,
) {
@ -125,9 +125,9 @@ fn mouse_movement_system(
}
if let Some(old_position) = *last_position {
for mut transform in query.iter_mut() {
for (mut transform, projection) in query.iter_mut() {
let offset = (old_position - position).extend(0.0) * Vec3::new(1., -1., 1.);
transform.translation += offset;
transform.translation += offset * projection.scale;
}
*last_position = Some(position);
}

View file

@ -13,12 +13,12 @@ impl Plugin for HoverPlugin {
/// A component that stores the hover texture and the original texture.
#[derive(Component, Clone)]
struct HoveredTexture {
pub struct HoveredTexture {
/// The original texture.
texture: Handle<Image>,
pub texture: Handle<Image>,
/// The hovered texture.
hovered_texture: Handle<Image>,
pub hovered_texture: Handle<Image>,
}
/// The system that applies the hover logic by changing the texture.