mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-01 01:18:38 +08:00 
			
		
		
		
	Refactor joystick (#876)
* Refactor joystick * Fix directional tests * Joystick example * Any PositionComponent can be used as knob and background * Add MarginButtonComponent * Fix JoystickExample * Update joystick docs * Fix joystick direction tests * Fix effect tests * Fix analyze issue * Update docs * Update docs * Move joystick to input export * Update packages/flame/lib/src/geometry/shape.dart Co-authored-by: Luan Nico <luanpotter27@gmail.com> * Add test and description for screenAngle * Update examples/lib/stories/controls/joystick_player.dart Co-authored-by: Erick <erickzanardoo@gmail.com> * Update doc/input.md Co-authored-by: Erick <erickzanardoo@gmail.com> * controls -> input in examples to align with export file * controls -> input * Add simple joystick example * Fix imports * velocity -> relativeDelta Co-authored-by: Luan Nico <luanpotter27@gmail.com> Co-authored-by: Erick <erickzanardoo@gmail.com>
This commit is contained in:
		
							
								
								
									
										81
									
								
								examples/lib/stories/input/input.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								examples/lib/stories/input/input.dart
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,81 @@ | ||||
| import 'package:dashbook/dashbook.dart'; | ||||
| import 'package:flame/game.dart'; | ||||
|  | ||||
| import '../../commons/commons.dart'; | ||||
| import 'draggables.dart'; | ||||
| import 'hoverables.dart'; | ||||
| import 'joystick.dart'; | ||||
| import 'joystick_advanced.dart'; | ||||
| import 'keyboard.dart'; | ||||
| import 'mouse_movement.dart'; | ||||
| import 'multitap.dart'; | ||||
| import 'multitap_advanced.dart'; | ||||
| import 'overlapping_tappables.dart'; | ||||
| import 'scroll.dart'; | ||||
| import 'tappables.dart'; | ||||
|  | ||||
| void addInputStories(Dashbook dashbook) { | ||||
|   dashbook.storiesOf('Input') | ||||
|     ..add( | ||||
|       'Keyboard', | ||||
|       (_) => GameWidget(game: KeyboardGame()), | ||||
|       codeLink: baseLink('input/keyboard.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Mouse Movement', | ||||
|       (_) => GameWidget(game: MouseMovementGame()), | ||||
|       codeLink: baseLink('input/mouse_movement.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Scroll', | ||||
|       (_) => GameWidget(game: ScrollGame()), | ||||
|       codeLink: baseLink('input/scroll.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Multitap', | ||||
|       (_) => GameWidget(game: MultitapGame()), | ||||
|       codeLink: baseLink('input/multitap.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Multitap Advanced', | ||||
|       (_) => GameWidget(game: MultitapAdvancedGame()), | ||||
|       codeLink: baseLink('input/multitap_advanced.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Tappables', | ||||
|       (_) => GameWidget(game: TappablesGame()), | ||||
|       codeLink: baseLink('input/tappables.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Overlaping Tappables', | ||||
|       (_) => GameWidget(game: OverlappingTappablesGame()), | ||||
|       codeLink: baseLink('input/overlaping_tappables.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Draggables', | ||||
|       (context) { | ||||
|         return GameWidget( | ||||
|           game: DraggablesGame( | ||||
|             zoom: context.listProperty('zoom', 1, [0.5, 1, 1.5]), | ||||
|           ), | ||||
|         ); | ||||
|       }, | ||||
|       codeLink: baseLink('input/draggables.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Hoverables', | ||||
|       (_) => GameWidget(game: HoverablesGame()), | ||||
|       codeLink: baseLink('input/hoverables.dart'), | ||||
|       info: 'Add more squares by clicking. Hover squares to change colors.', | ||||
|     ) | ||||
|     ..add( | ||||
|       'Joystick', | ||||
|       (_) => GameWidget(game: JoystickGame()), | ||||
|       codeLink: baseLink('input/joystick.dart'), | ||||
|     ) | ||||
|     ..add( | ||||
|       'Joystick Advanced', | ||||
|       (_) => GameWidget(game: JoystickAdvancedGame()), | ||||
|       codeLink: baseLink('input/joystick_advanced.dart'), | ||||
|     ); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Lukas Klingsbo
					Lukas Klingsbo