Back to project page tetris-android.
The source code is released under:
MIT License
If you think the Android project tetris-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.badlogic.androidgames.framework.impl; //from ww w. j av a2s . co m import java.util.List; import android.content.Context; import android.os.Build.VERSION; import android.view.View; import com.badlogic.androidgames.framework.Input; public class AndroidInput implements Input { AccelerometerHandler accelHandler; KeyboardHandler keyHandler; TouchHandler touchHandler; public AndroidInput(Context context, View view, float scaleX, float scaleY) { accelHandler = new AccelerometerHandler(context); keyHandler = new KeyboardHandler(view); // if(Integer.parseInt(VERSION.SDK) < 5) touchHandler = new SingleTouchHandler(view, scaleX, scaleY); // else // touchHandler = new MultiTouchHandler(view, scaleX, scaleY); } @Override public boolean isKeyPressed(int keyCode) { return keyHandler.isKeyPressed(keyCode); } @Override public boolean isTouchDown(int pointer) { return touchHandler.isTouchDown(pointer); } @Override public int getTouchX(int pointer) { return touchHandler.getTouchX(pointer); } @Override public int getTouchY(int pointer) { return touchHandler.getTouchY(pointer); } @Override public float getAccelX() { return accelHandler.getAccelX(); } @Override public float getAccelY() { return accelHandler.getAccelY(); } @Override public float getAccelZ() { return accelHandler.getAccelZ(); } @Override public List<TouchEvent> getTouchEvents() { return touchHandler.getTouchEvents(); } @Override public List<KeyEvent> getKeyEvents() { return keyHandler.getKeyEvents(); } }