Skip to content

Getting Started

Damien Brun edited this page Nov 16, 2017 · 2 revisions

Here is a very simple snippets to use it. Just set the onMoveListener to retrieve its angle and strength.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ...

    JoystickView joystick = (JoystickView) findViewById(R.id.joystickView);
    joystick.setOnMoveListener(new JoystickView.OnMoveListener() {
        @Override
        public void onMove(int angle, int strength) {
            // do whatever you want
        }
    });
}
Clone this wiki locally