FlightInterp_Andorid/java/com/example/ex4/JoystickActivity.java
2019-06-21 01:19:07 +03:00

27 lines
854 B
Java

package com.example.ex4;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class JoystickActivity extends AppCompatActivity implements Joystick.JoystickListener
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_joystick);
}
//method to handle OnJoystickMoved event
public void onJoystickMoved(float xPercent, float yPercent, int source)
{
UserHandler handler = UserHandler.getInstance();
handler.send_message(true, xPercent); //true is aileron
handler.send_message(false, yPercent); //false is elevator
}
@Override
protected void onDestroy()
{
super.onDestroy();
UserHandler.getInstance().disconnect();
}
}