package de.frajul.endlessroll.main;

import android.content.Context;
import android.opengl.GLSurfaceView;

import de.frajul.endlessroll.rendering.Rendering;
import de.frajul.endlessroll.rendering.renderer.GameRenderer;

/**
 * Created by Julian on 30.07.2016.
 */
public class MyGlSurfaceView extends GLSurfaceView {

    private GameRenderer renderer;

    public MyGlSurfaceView(Context context, GameRenderer gameRenderer) throws Exception {
        super(context);
        this.renderer = gameRenderer;
        super.setEGLContextClientVersion(2);
        super.setRenderer(renderer);
    }

    public void addRendering(Rendering rendering) {
        renderer.addRendering(rendering);
    }

    public void setCurrentRendering(Rendering currentRendering) {
        super.setOnTouchListener(currentRendering);
        renderer.setCurrentRendering(currentRendering);
    }

    @Override
    public void onResume() {
        GameLog.i("GLSurfaceView: onResume");
        super.onResume();
    }

    @Override
    public void onPause() {
        GameLog.i("GLSurfaceView: onPause");
        super.onPause();
    }
}
