摇杆
DFJoyStick是完全用Flutter实现的Widget,默认是8方向的,可以设置背景图片和一些基本样式。
/// 摇杆
Positioned(
bottom: MediaQuery.of(context).padding.bottom + 30,
left: 30,
child: DFJoyStick(
//backgroundImage: "assets/images/ui/joystick.png",
//handleImage: "assets/images/ui/joystick_btn.png",
onChange: (double radians, String direction) {
_playerSprite?.play(action: DFAnimation.RUN, direction: direction, radians: radians);
},
onCancel: (direction) {
_playerSprite?.play(action: DFAnimation.IDLE, direction: direction);
},
),
),
本站内容来源于作者发布和网络转载,如有版权相关问题请及时与我们取得联系,我们将立即删除。