#Multiple mouse input systems

3 messages · Page 1 of 1 (latest)

tiny granite
#

Hello! Question about code organising:
I have mouse_input_system system which handles all mouse input events. It's huge. And it takes a lot of resources and queries and I think it's bad for performance, not to mention readability.
Is it possible to split that system to multiple smaller systems? Like: on_mouse_left_click, on_mouse_left_release, on_mouse_right_click, on_mouse_left_hold(1.0), on_mouse_left_double_click etc. Also it would be nice to have something like on_mouse_left_click_in_state::<AppState::Play>(), on_mouse_left_click_in_state::<AppState::Pause>() (just as idea). Sorry for bad English.

lapis willow
#

you could split it up into separate systems that each subscribe to the same event reader

#

and if you use iyes_loopless, you can do something like

app.add_system(mouse_left_click_in_state.run_in_state(AppState::Play));