package org.ntlab.radishforandroidstudio.framework.gameMain;

import android.os.Bundle;
import android.widget.LinearLayout;

import org.ntlab.radishforandroidstudio.framework.RWT.RWTSurfaceView;
import org.ntlab.radishforandroidstudio.framework.model3D.Universe;
import org.ntlab.radishforandroidstudio.framework.view3D.Camera3D;

//addcontentViewのサンプルとして作成
public abstract class RealTime3DActivity extends RealTimeActivity {
	protected Universe universe;
	protected Camera3D camera;
	protected RWTSurfaceView view;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		universe = new Universe();

		camera = new Camera3D(universe);

		view = new RWTSurfaceView(this);
		view.setRenderMode(RWTSurfaceView.RENDERMODE_WHEN_DIRTY);
		view.attachCamera(camera);

		addContentView(view,new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

	}

	protected void update(long interval) {
		progress(interval);
		universe.update(interval);
		camera.adjust(interval);
		view.requestRender();
	}

	abstract protected void progress(long interval);
}
