Newer
Older
Cactus-CleanArchitecture / app / src / main / java / org / ntlab / radishforandroidstudio / framework / gameMain / RealTime3DActivity.java
s-iwatani on 17 May 2018 977 bytes 設計変更
package org.ntlab.radishforandroidstudio.framework.gameMain;

import android.os.Bundle;

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

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);
		setContentView(view);
	}

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