Newer
Older
CactusClient / src / framework / RWT / RWTSurfaceView.java
s-iwatani on 15 May 2018 938 bytes 途中
package framework.RWT;

import framework.view3D.Camera3D;
import android.content.Context;
import android.opengl.GLSurfaceView;

import javax.microedition.khronos.opengles.GL10;

public class RWTSurfaceView extends GLSurfaceView {
	protected RWTRenderer renderer;
	protected RWTSprites sprites = new RWTSprites();

	public RWTSurfaceView(Context context) {
		this(context, true);
	}

	public RWTSurfaceView(Context context, boolean bInitRenderer) {
		super(context);
		if (bInitRenderer) {
			renderer = new RWTRenderer();
			renderer.attachSprites(sprites);
			setEGLConfigChooser(8, 8, 8, 8, 16, 0);
			this.setRenderer(renderer);			
		}
	}

	public GL10 getGl() {
		return renderer.getGl();
	}

	public void attachCamera(Camera3D camera) {
		renderer.attachCamera(camera);
	}

	public void addSprite(RWTSprite sprite) {
		sprites.addSprite(sprite);
	}

	public void removeSprite(RWTSprite sprite) {
		sprites.removeSprite(sprite);
	}
}