AndEngine Tutorial:マルチタッチ
1309 ワード
「andenginemultitouchextension.jar」が必要です
@Override
public Engine onLoadEngine() {
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
final Engine engine = new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
//
try {
if(MultiTouch.isSupported(this)) {
engine.setTouchController(new MultiTouchController());
if(MultiTouch.isSupportedDistinct(this)) {
Toast.makeText(this, "MultiTouch detected --> Drag multiple Sprites with multiple fingers!", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "MultiTouch detected --> Drag multiple Sprites with multiple fingers!
(Your device might have problems to distinguish between separate fingers.)", Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(this, "Sorry your device does NOT support MultiTouch!
(Falling back to SingleTouch.)", Toast.LENGTH_LONG).show();
}
} catch (final MultiTouchException e) {
Toast.makeText(this, "Sorry your Android Version does NOT support MultiTouch!
(Falling back to SingleTouch.)", Toast.LENGTH_LONG).show();
}
return engine;
}