天天看点

Android游戏之输入类设计(传感器,键盘,触摸点)Android游戏之输入类设计(传感器,键盘,触摸点)

<a target="_blank" href="http://developer.android.com/reference/android/hardware/SensorEventListener.html">http://developer.android.com/reference/android/hardware/SensorEventListener.html</a>

Class Overview

--------------------------------------------------------------------------------

Used for receiving notifications from the SensorManager when sensor values have changed.

Summary

Public Methods

 abstract void  onAccuracyChanged(Sensor sensor, int accuracy)

Called when the accuracy of the registered sensor has changed.

 abstract void  onSensorChanged(SensorEvent event)

Called when sensor values have changed. 

<a target="_blank" href="http://developer.android.com/reference/android/view/View.OnKeyListener.html">http://developer.android.com/reference/android/view/View.OnKeyListener.html</a>

Interface definition for a callback to be invoked when a hardware key event is dispatched to this view. The callback will be invoked before the key event is given to the view. This is only useful for hardware keyboards; a software input method has no obligation to trigger this listener.

 abstract boolean  onKey(View v, int keyCode, KeyEvent event)

Called when a hardware key is dispatched to a view. 

<a target="_blank" href="http://developer.android.com/reference/android/view/View.OnTouchListener.html">http://developer.android.com/reference/android/view/View.OnTouchListener.html</a>

Interface definition for a callback to be invoked when a touch event is dispatched to this view. The callback will be invoked before the touch event is given to the view.

 abstract boolean  onTouch(View v, MotionEvent event)

Called when a touch event is dispatched to a view. 

本文浅述了“beginning-android-games”书本的相关基础知识和相关类的设计分析,

本篇中的类实现来自“beginning-android-games\ch07-gl-basics”

继续阅读