Updated todo

This commit is contained in:
pelya
2013-02-02 00:06:00 +02:00
parent 7391de60c6
commit 02877fdbdc
3 changed files with 29 additions and 18 deletions

View File

@@ -42,6 +42,7 @@ class AccelerometerReader implements SensorEventListener
private SensorManager _manager = null; private SensorManager _manager = null;
public boolean openedBySDL = false; public boolean openedBySDL = false;
private final GyroscopeListener gyro = new GyroscopeListener();
public AccelerometerReader(Activity context) public AccelerometerReader(Activity context)
{ {
@@ -54,6 +55,7 @@ class AccelerometerReader implements SensorEventListener
{ {
System.out.println("libSDL: stopping accelerometer/gyroscope"); System.out.println("libSDL: stopping accelerometer/gyroscope");
_manager.unregisterListener(this); _manager.unregisterListener(this);
_manager.unregisterListener(gyro);
} }
} }
@@ -62,38 +64,42 @@ class AccelerometerReader implements SensorEventListener
if( (Globals.UseAccelerometerAsArrowKeys || Globals.AppUsesAccelerometer) && _manager != null ) if( (Globals.UseAccelerometerAsArrowKeys || Globals.AppUsesAccelerometer) && _manager != null )
{ {
System.out.println("libSDL: starting accelerometer"); System.out.println("libSDL: starting accelerometer");
// TODO: orientation allows for 3rd axis - azimuth, but it will be way too hard to the user
// if( ! _manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_GAME) )
_manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME); _manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME);
} }
if( Globals.AppUsesGyroscope && _manager != null ) if( Globals.AppUsesGyroscope && _manager != null )
{ {
System.out.println("libSDL: starting gyroscope"); System.out.println("libSDL: starting gyroscope");
_manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME); _manager.registerListener(gyro, _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME);
} }
} }
public synchronized void onSensorChanged(SensorEvent event) { public void onSensorChanged(SensorEvent event)
{
if( Globals.HorizontalOrientation )
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]);
else
nativeAccelerometer(event.values[0], event.values[1], event.values[2]); // TODO: not tested!
}
public void onAccuracyChanged(Sensor s, int a)
{
}
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) class GyroscopeListener implements SensorEventListener
{
public GyroscopeListener()
{ {
if( Globals.HorizontalOrientation )
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]);
else
nativeAccelerometer(event.values[0], event.values[1], event.values[2]); // TODO: not tested!
} }
if (event.sensor.getType() == Sensor.TYPE_GYROSCOPE) public void onSensorChanged(SensorEvent event)
{ {
// TODO: vertical orientation
//if( Globals.HorizontalOrientation ) //if( Globals.HorizontalOrientation )
nativeGyroscope(event.values[0], event.values[1], event.values[2]); nativeGyroscope(event.values[0], event.values[1], event.values[2]);
// TODO: vertical orientation
} }
public synchronized void onAccuracyChanged(Sensor s, int a)
{
}
} }
public synchronized void onAccuracyChanged(Sensor s, int a) { private static native void nativeAccelerometer(float accX, float accY, float accZ);
} private static native void nativeGyroscope(float X, float Y, float Z);
private native void nativeAccelerometer(float accX, float accY, float accZ);
private native void nativeGyroscope(float X, float Y, float Z);
} }

View File

@@ -1,6 +1,11 @@
Requested features (see also bugs.txt) Requested features (see also bugs.txt)
====================================== ======================================
- Fast event queue and joystick event trottling in SDL - remove mutex from SDL_ANDROID_PumpEvents(),
and add another compatibility hack option, because queue got bloated and my phone rebooted.
- Gyroscope calibration dialog.
- Option for default on-screen key theme in AndroidAppSettings.cfg. - Option for default on-screen key theme in AndroidAppSettings.cfg.
- Select between normal mouse input and magnifying glass/relative input automatically, based on screen size. - Select between normal mouse input and magnifying glass/relative input automatically, based on screen size.