flame
flame copied to clipboard
Collect events-related functionality into a single directory
What could be improved
Currently, the code that is related to event handling lives in multiple different locations in Flame's source code tree. It can be found in the following places:
- components/mixins/draggable.dart
- components/mixins/hoverable.dart
- components/mixins/keyboard_handler.dart
- components/mixins/tappable.dart
- game/mixins/has_draggables.dart
- game/mixins/has_hoverables.dart
- game/mixins/has_tappables.dart
- game/mixins/keyboard.dart
- game/mixins/multi_touch_tap_detector.dart
- gestures/detectors.dart
- gestures/events.dart
- events/interfaces/multi_tap_listener.dart
All this functionality is highly related yet lives in multiple places, which increases burden when reading the code.
In addition, when adding new events-related functionality it's hard to figure out where to put it.
Suggestion: move all code related to events handling into the top-level events/ directory, possibly with multiple nesting levels inside for Game mixins, FlameGame mixins, Component mixins, and so on.
Any risks?
No, since we can leave the export structure exactly as it is right now.
More information
Are you interested in working on a PR for this? Yes.