package anim;
import java.io.File;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import listener.Clavier;
import listener.Souris;
import com.jogamp.opengl.util.FPSAnimator;
public class Anim extends GLCanvas{
private static final long serialVersionUID = 1L;
private Scene glListener;
final FPSAnimator animator;
public Anim() {
super(new GLCapabilities(GLProfile.getDefault()));
glListener = new Scene();
this.addKeyListener(new Clavier(glListener));
this.addMouseListener(new Souris(glListener));
this.addGLEventListener(glListener);
animator = new FPSAnimator(this, 60);
}
/* ***** ***** */
public Scene getScene() {
return glListener;
}
public void loadFile(File fic){
glListener.getWorld().loadFile(fic);
}
/* ***** ***** */
public void start(){
if ( animator.isPaused() ){
animator.resume();
}else{
animator.start();
}
}
public void pause(){
animator.pause();
}
public void stop(){
this.removeGLEventListener(glListener);
animator.stop();
}
}