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

support multiple pointer devices #15

Open
karroffel opened this issue Jun 5, 2020 · 5 comments
Open

support multiple pointer devices #15

karroffel opened this issue Jun 5, 2020 · 5 comments
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 S-Blocked This cannot move forward until something else changes

Comments

@karroffel
Copy link
Contributor

The current Input<MouseButton> interface is very nice but implies the existence of a single mouse input device.

In future maybe multiple mice or touch inputs want to be supported (touch having a "backwards compatible" interface with MouseButton maybe?), for that a mechanism to select/retrieve the input device ID would be needed.

@karroffel karroffel added C-Feature A new feature, making something new possible A-Input Player input via keyboard, mouse, gamepad, and more labels Aug 12, 2020
@inodentry
Copy link
Contributor

Now that bevy has an API for touch input (and since mice and touch are different things anyway), can we adjust this issue (change the title, etc) to be about supporting multiple mice / pointer devices, specifically?

@karroffel karroffel changed the title support multiple mice / touch events support multiple pointer devices Oct 21, 2020
superdump referenced this issue in superdump/bevy Jul 2, 2021
cart pushed a commit that referenced this issue Jul 24, 2021
cart pushed a commit that referenced this issue Jul 24, 2021
pcwalton pushed a commit to pcwalton/bevy that referenced this issue Aug 30, 2021
@bushrat011899
Copy link
Contributor

This feels like a surprisingly straight-forward problem to be the oldest open issue on Bevy.

tigregalis pushed a commit to tigregalis/bevy that referenced this issue Jun 24, 2024
@BenjaminBrienen BenjaminBrienen added S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Sep 27, 2024
@Lege19
Copy link

Lege19 commented Nov 10, 2024

I'm looking into working on this as my first contribution, and I'd like some affirmation that the way I have a sensible plan:

  • MultiMouseButtonInput: event struct containing a MouseButtonInput and a winit::event::DeviceId
  • MultiMouseMotion: event struct containing a MouseMotion and a winit::event::DeviceId
  • MultiMouseWheel: event struct containing a MouseWheel and a winit::event::DeviceId
  • MultiMouseButton: struct containing a MouseButton and a winit::event::DeviceId
  • multi_mouse_button_input_system: the equivalent of mouse_button_input_system, but for ButtonInput<MultiMouseButton> (I'd separate these into different systems because they do not require access to any of the same resources or event readers and so they could run in parallel)
  • Update <InputPlugin as Plugin>::build to include .init_event::<...> for the above events
  • Update <InputPlugin as Plugin>::build to include .init_resource::<ButtonInput<MultiMouseButton>>
  • Update <InputPlugin as Plugin>::build to include .add_systems(PreUpdate, multi_mouse_button_input_system.in_set(InputSystem))
  • Update <InputPlugin as Plugin>::build to include .register_type::<MultiMouseButtonInput>
  • Add variants to bevy_window::event::WindowEvent for the above events
  • Add bevy_winit::converters::convert_multi_mouse_button(mouse_button: winit::event::MouseButton) -> MultiMouseButton
  • Update bevy_winit::state::window_event to emit MultiMouseButtonInput and MultiMouseWheel in addition to the existing mouse events
  • Update bevy_winit::state::device_event to emit MultiMouseMotion as well as MouseMotion

I think I'm not going to try and update bevy's pointer API's to support multiple pointers associated with different pointer devices, since (I think) those are supposed to imitate the underlying OS's pointer behavior, and most (all?) OS's don't this.

@NthTensor
Copy link
Contributor

NthTensor commented Nov 10, 2024

Hey, just so you're aware, winit (our windowing lib) is moving to a pointer abstraction in its next release. So I think we are probably just going to switch to a unified pointer api (and possibly scrap a big portion of the existing bevy_input) instead of making additions to what we already have.

@BenjaminBrienen BenjaminBrienen added S-Blocked This cannot move forward until something else changes and removed S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! labels Nov 10, 2024
@Lege19
Copy link

Lege19 commented Nov 10, 2024

I was not aware, thanks for saving me the trouble, I'll look for another issue that seems doable.

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 S-Blocked This cannot move forward until something else changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants