簡単なシーンを作成して表示しようとしていますが、うまくいかず、何が間違っているのかわかりません。
主な活動はこちら
public class MainActivity extends BaseGameActivity implements IOnSceneTouchListener{
final static String TAG = "BounceTest";
Scene scene;
float downX;
float downY;
@Override
public EngineOptions onCreateEngineOptions() {
Log.d(TAG, "onCreateEngineOptions");
return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), new Camera(0, 0, 800, 480));
}
@Override
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception {
Log.d(TAG, "onCreateResources");
}
@Override
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws Exception {
Log.d(TAG, "onCreateScene");
scene = new Scene(){
@Override
protected void onManagedUpdate(float pSecondsElapsed) {
Log.d(TAG, "onManagedUpdate");
super.onManagedUpdate(pSecondsElapsed);
}
};
this.getEngine().setScene(scene);
scene.setOnSceneTouchListener(this);
}
@Override
public void onPopulateScene(Scene pScene, OnPopulateSceneCallback pOnPopulateSceneCallback) throws Exception {
Log.d(TAG, "onPopulateScene");
Rectangle floor = new Rectangle(-200, 0, 1000, 20, this.getVertexBufferObjectManager());
Rectangle square = new Rectangle(0, 20, 20, 20, this.getVertexBufferObjectManager());
scene.attachChild(floor);
scene.attachChild(square);
}
@Override
public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
Log.d(TAG, "onSceneTouchEvent");
if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN){
downX = pSceneTouchEvent.getX();
downY = pSceneTouchEvent.getY();
}else if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP){
float upX = pSceneTouchEvent.getX();
float upY = pSceneTouchEvent.getY();
float xDiff = downX - upX;
float yDiff = downY - upY;
float dragLength = (float)Math.sqrt(xDiff*xDiff+yDiff*yDiff);
Log.d(TAG, "dragLength:"+dragLength);
}
return false;
}
}
携帯電話に表示されるのは黒い画面だけです (四角形はありません)。「onManagedUpdate」は表示されず、画面に触れても onSceneTouchEvent は呼び出されません。
どうしてこんなことに?