Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse input accumulation #14044

Merged
merged 9 commits into from
Jul 1, 2024

Conversation

Aztro-dev
Copy link
Contributor

@Aztro-dev Aztro-dev commented Jun 27, 2024

Objective

Solution

  • Created two resources, AccumulatedMouseMotion and AccumulatedMouseScroll, and a method that tracks the MouseMotion and MouseWheel events and accumulates their deltas every frame.
  • Also modified the mouse input example to show how to use the resources.

Testing

  • Tested the changes by modifying an existing example to use the newly added resources, and moving/scrolling my trackpad around a ton.

@alice-i-cecile alice-i-cecile added A-Input Player input via keyboard, mouse, gamepad, and more D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Feature A new feature, making something new possible M-Needs-Release-Note Work that should be called out in the blog due to impact labels Jun 27, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this :) I've left some feedback covering how I think we can improve this. If you're looking for ideas on docs or implementation, please feel free to borrow liberally from my implementation in LWIM.

@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Jun 27, 2024
Aztro-dev and others added 4 commits June 27, 2024 11:21
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, thanks for the prompt and agreeable response :)

Copy link
Contributor

@MScottMcBee MScottMcBee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if the mouse_input or mouse_input_events examples were updated to show these off

crates/bevy_input/src/mouse.rs Outdated Show resolved Hide resolved
@Aztro-dev
Copy link
Contributor Author

It would be great if the mouse_input or mouse_input_events examples were updated to show these off

I already updated the mouse_input example, but I don't know if this change would really fit in the mouse_input_events example as we only really implemented a Resource, not an Event

@MScottMcBee
Copy link
Contributor

MScottMcBee commented Jun 27, 2024

It would be great if the mouse_input or mouse_input_events examples were updated to show these off

I already updated the mouse_input example

Whoops, don't know how I missed that 😅 . LGTM

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 27, 2024
crates/bevy_input/src/mouse.rs Outdated Show resolved Hide resolved
crates/bevy_input/src/lib.rs Show resolved Hide resolved
crates/bevy_input/src/mouse.rs Outdated Show resolved Hide resolved
crates/bevy_input/src/mouse.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Jun 27, 2024
Aztro-dev and others added 3 commits June 28, 2024 10:37
Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
@MrGVSV MrGVSV added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jun 28, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 1, 2024
Merged via the queue into bevyengine:main with commit 6dcff2b Jul 1, 2024
28 checks passed
zmbush pushed a commit to zmbush/bevy that referenced this pull request Jul 3, 2024
# Objective

- Add the `AccumulatedMouseMotion` and `AccumulatedMouseScroll`
resources to make it simpler to track mouse motion/scroll changes
- Closes bevyengine#13915

## Solution

- Created two resources, `AccumulatedMouseMotion` and
`AccumulatedMouseScroll`, and a method that tracks the `MouseMotion` and
`MouseWheel` events and accumulates their deltas every frame.
- Also modified the mouse input example to show how to use the
resources.

## Testing

- Tested the changes by modifying an existing example to use the newly
added resources, and moving/scrolling my trackpad around a ton.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
MrGVSV added a commit to MrGVSV/bevy that referenced this pull request Jul 5, 2024
# Objective

- Add the `AccumulatedMouseMotion` and `AccumulatedMouseScroll`
resources to make it simpler to track mouse motion/scroll changes
- Closes bevyengine#13915

## Solution

- Created two resources, `AccumulatedMouseMotion` and
`AccumulatedMouseScroll`, and a method that tracks the `MouseMotion` and
`MouseWheel` events and accumulates their deltas every frame.
- Also modified the mouse input example to show how to use the
resources.

## Testing

- Tested the changes by modifying an existing example to use the newly
added resources, and moving/scrolling my trackpad around a ton.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes M-Needs-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add resources for accumulated mouse motion and mouse scroll
4 participants