mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 12:28:03 +08:00
Feat: Add keyboard with focus node implementation (#909)
* Add keyboard with focus node implementation * a * format and make it stabel compatible * Add mixin to game * fixes * add tests * format * docs * more docs * Update doc/keyboard-input.md Co-authored-by: Erick <erickzanardoo@gmail.com> * rename test * Apply suggestions from code review Co-authored-by: Luan Nico <luanpotter27@gmail.com> * fix test * Update tutorials/2_sprite_animations_gestures/README.md Co-authored-by: Luan Nico <luanpotter27@gmail.com> * docs * Apply suggestions from code review Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net> * yo Co-authored-by: Erick <erickzanardoo@gmail.com> Co-authored-by: Luan Nico <luanpotter27@gmail.com> Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
This commit is contained in:
@ -162,7 +162,7 @@ Finally, we just render it on the game `render` function:
|
||||
```dart
|
||||
@override
|
||||
void render(Canvas canvas) {
|
||||
// Running robot render omited
|
||||
// Running robot render omitted
|
||||
|
||||
final button = isPressed ? pressedButton : unpressedButton;
|
||||
button.render(canvas, position: buttonPosition, size: buttonSize);
|
||||
@ -173,7 +173,8 @@ You now should see the button on the screen, but right now, it is pretty much us
|
||||
|
||||
So, to change that, we will now add some interactivity to our game and make the button tappable/clickable.
|
||||
|
||||
Flame provides several input handlers, which you can check with more in depth on [our docs](https://github.com/flame-engine/flame/blob/main/doc/input.md). For this tutorial, we will be using the `TapDetector` which enables us to detect taps on the screen, as well as mouse click when running on web or desktop.
|
||||
Flame provides several input handlers, about which you can check with more in depth on [our docs](https://github.com/flame-engine/flame/blob/main/doc/gesture-input.md).
|
||||
For this tutorial, we will be using the `TapDetector` which enables us to detect taps on the screen, as well as mouse click when running on web or desktop.
|
||||
|
||||
All Flame input detectors are mixins which can be added to your game, enabling you to override listener methods related to that detector. For the `TapDetector`, we will need to override three methods:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user