Package anim

Source Code of anim.Anim

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

}
TOP

Related Classes of anim.Anim

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.