天天看點

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”

繼續閱讀