Graphics Programs Reference
In-Depth Information
Listing
2-16.
SENSOR ROTATION/src/com/apress/android/sensorrotation/
Main.java
if (_gravityFiltered >= 6
&& _gravityFiltered <= SensorManager.GRAVITY_EARTH *
1) {
scaling = _SENSITIVITY
+ (2 - (_gravityFiltered /
SensorManager.GRAVITY_EARTH));
_orientationFiltered = _orientationFiltered * (1.0f -
_a)
+ _outR[0] * _a;
float zAngle = scaling * _orientationFiltered * 90;
GLES20Renderer.setZAngle(zAngle);
_textView.setText("Angle: "
+ Float.valueOf(zAngle).toString() + "\n");
_textView.append("Fraction: "
+ Float.valueOf(_orientationFiltered).toString()
+ "\n");
_textView.append("Pitch: "
+ Float.valueOf(_values[1]).toString() + "\n");
_textView
.append("Gravity: "
+ Float.valueOf(_gravityFiltered)
.toString() + "\n");
}
The logic used in the
TOUCHROTATION
and
SENSORROTATION
applications for
obtaining inputs is also used in the
Tank Fence
game to implement the UI. So once
again, go carefully through the class
Main
and the callback methods from these ap-
plications. This will make you more efficient with UI for applications.
Summary
At the beginning of this chapter I laid down some basic design principles for mobile
game development in order to explain the role of sleek designs for our games. We
Search WWH ::

Custom Search