JoystickAction constructor
JoystickAction({
- required dynamic actionId,
- Future<
Sprite> ? sprite, - Future<
Sprite> ? spritePressed, - Future<
Sprite> ? spriteBackgroundDirection, - bool enableDirection = false,
- double size = 50,
- double sizeFactorBackgroundDirection = 1.5,
- EdgeInsets margin = EdgeInsets.zero,
- Color color = Colors.blueGrey,
- JoystickActionAlign align = JoystickActionAlign.BOTTOM_RIGHT,
- double opacityBackground = 0.5,
- double opacityKnob = 0.8,
Implementation
JoystickAction({
required this.actionId,
Future<Sprite>? sprite,
Future<Sprite>? spritePressed,
Future<Sprite>? spriteBackgroundDirection,
this.enableDirection = false,
this.size = 50,
this.sizeFactorBackgroundDirection = 1.5,
this.margin = EdgeInsets.zero,
this.color = Colors.blueGrey,
this.align = JoystickActionAlign.BOTTOM_RIGHT,
this.opacityBackground = 0.5,
this.opacityKnob = 0.8,
}) {
_loader?.add(AssetToLoad(sprite, (value) {
this.sprite = value;
}));
_loader?.add(AssetToLoad(spritePressed, (value) {
this.spritePressed = value;
}));
_loader?.add(AssetToLoad(spriteBackgroundDirection, (value) {
this.spriteBackgroundDirection = value;
}));
_sizeBackgroundDirection = sizeFactorBackgroundDirection * size;
_tileSize = _sizeBackgroundDirection / 2;
}