Exemple #1
0
  public void start() {
    // ウィンドウの生成
    try {
      Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
      // Display.setTitle("SimField");
      Display.create();
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(0);
    }

    initGL();

    // メインループ
    while (!Display.isCloseRequested()) {
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
      /**
       * for(Life l : lifeSet.getArray()){ l.renderLife(); } for(Life lr: lifeRedSet.getArray()){
       * lr.renderLife(); } for(Life lb: lifeBlueSet.getArray()){ lb.renderLife(); }
       */
      for (Life l : life) {
        l.renderLife();
      }
      for (Life lr : lifeRed) {
        lr.renderLife();
      }
      for (Life lb : lifeBlue) {
        lb.renderLife();
      }
      status.updateFPS();
      Display.update(); // オンスクリーンに反映
      Display.sync(60); // FPSを60に固定
    }
  }
Exemple #2
0
  public void start() {
    try {
      Display.setDisplayMode(new DisplayMode(800, 600));
      Display.create();
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(0);
    }

    initGL(); // init OpenGL
    try {
      font = new Font("assets/text.png", "assets/text.txt", 6, 13);
      font.buildFont(2); // build the textures for text
      s = new Sprite("assets/pokemon_sprites/front/643.png");
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(0);
    }
    getDelta(); // call once before loop to initialise lastFrame
    lastFPS = getTime(); // call before loop to initialise fps timer

    while (!Display.isCloseRequested() && !finished) {
      int delta = getDelta();

      update(delta);
      renderGL();

      Display.update();
      Display.sync(60); // cap fps to 60fps
    }

    Display.destroy();
  }
  /**
   * *************************************************************************************************************************************************************************************************
   * Initialization stuff comes in here...
   * ************************************************************************************************************************************************************************************************
   */
  private void init() {

    try {
      Display.setDisplayMode(new DisplayMode(640, 480));
      Display.setVSyncEnabled(true);
      Display.setTitle("MS3D Loader [G36C]");
      Display.create();

      Keyboard.create();

    } catch (LWJGLException e) {
      Sys.alert("Error", "Initialization failed!\n\n" + e.getMessage());
      System.exit(0);
    }

    /* OpenGL */
    int width = Display.getDisplayMode().getWidth();
    int height = Display.getDisplayMode().getHeight();

    GL11.glViewport(0, 0, width, height); // Reset The Current Viewport
    GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
    GL11.glLoadIdentity(); // Reset The Projection Matrix
    GLU.gluPerspective(
        45.0f,
        ((float) width / (float) height),
        0.1f,
        1000.0f); // Calculate The Aspect Ratio Of The Window
    GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix
    GL11.glLoadIdentity(); // Reset The Modelview Matrix

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Background color
    GL11.glClearDepth(1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    // Load model
    //		g36c = new
    // MS3DModel(resourceLoader.loadResourceAsStream("models/gsg9.ms3d"),this.getClass().getResource("./data/textures").getPath());
    g36c =
        new MS3DModel(
            resourceLoader.loadResourceAsStream("models/assassin.ms3d"),
            this.getClass().getResource("./data/textures").getPath());

    //		tdsLoader=new TDSLoader();
    //		try {
    //			tdsLoader.load(resourceLoader.loadResourceAsStream("models/face.3ds"));
    //			System.out.println(tdsLoader.getObjectSize());
    //		} catch (IOException e) {
    //			e.printStackTrace();
    //		}

    // Load font
    font = new Font(resourceLoader.loadResourceAsStream("textures/font.bmp"), 12, width, height);

    // Init timer
    timer = new Timer();
  }
Exemple #4
0
  private void initialise() {
    DisplayMode mode = new DisplayMode(WIDTH, HEIGHT);
    Display.setTitle(TITLE);

    input = new InputHandler();
    display = new CodeDisplay(input);

    try {
      Display.setDisplayMode(mode);
      Display.setResizable(false);
      Display.create();

      if (!GLContext.getCapabilities().OpenGL33)
        System.err.printf("You must have at least OpenGL 3.3 to run this program\n");
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(-1);
    }

    // Set clear color

    glShadeModel(GL_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL); // Less than or equal
    glClearDepth(1.0);

    establishProjectionMatrix();

    // glEnable(GL_LIGHTING);
    // glEnable(GL_LIGHT0);
  }
Exemple #5
0
  public Render(Level level) {
    this.level = level;
    try {
      Display.setFullscreen(true);
    } catch (LWJGLException e) {
      e.printStackTrace();
    }

    // Enable vsync if we can
    Display.setVSyncEnabled(true);

    try {
      Display.create();
    } catch (LWJGLException e) {
      e.printStackTrace();
    }

    // Put the window into orthographic projection mode with 1:1 pixel
    // ratio.
    // We haven't used GLU here to do this to avoid an unnecessary
    // dependency.

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(
        0.0,
        Display.getDisplayMode().getWidth(),
        0.0,
        Display.getDisplayMode().getHeight(),
        -1.0,
        1.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
  }
Exemple #6
0
  public static void main(String[] args) {

    Main main = new Main();
    Viewer viewer;
    try {
      viewer = new Viewer();
      GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);

      Scene scene = viewer.getScene();

      // viewer.setProjection(new OrthogonalProjection(0, 800, 600, 0, 1, -1));

      // GL11.glMatrixMode(GL11.GL_MODELVIEW);
      // GL11.glRectf(100.0f, 150.0f, 150.0f, 100.0f);
      MenuButton m = new MenuButton(250.0f, 50.0f, 600.0f, 100.0f, "Bzinga", 1);

      scene.add(m);
      // scene.render();
      viewer.run();

    } catch (LWJGLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Exemple #7
0
  /** Tests the DisplayConfiguration */
  private void setDisplayConfigurationTest() {
    System.out.println("==== Test setDisplayConfigurationTest ====");

    System.out.println("Testing normal setting");
    changeConfig(1.0f, 0f, 1f);

    System.out.println("Testing gamma settings");
    changeConfig(5.0f, 0f, 1f);
    changeConfig(0.5f, 0f, 1f);

    System.out.println("Testing brightness settings");
    changeConfig(1.0f, -1.0f, 1f);
    changeConfig(1.0f, -0.5f, 1f);
    changeConfig(1.0f, 0.5f, 1f);
    changeConfig(1.0f, 1.0f, 1f);

    System.out.println("Testing contrast settings");
    changeConfig(1.0f, 0f, 0f);
    changeConfig(1.0f, 0f, 0.5f);
    changeConfig(1.0f, 0f, 10000.0f);

    System.out.print("resetting...");
    try {
      Display.setFullscreen(false);
    } catch (LWJGLException e) {
      e.printStackTrace();
    }
    System.out.println("done");

    System.out.println("---- Test setDisplayConfigurationTest ----");
  }
  public void start() {
    try {
      Display.setDisplayMode(new DisplayMode(800, 600));
      Display.create();
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(0);
    }

    initGL(); // init OpenGL
    getDelta(); // call once before loop to initialise lastFrame
    lastFPS = getTime(); // call before loop to initialise fps timer

    while (!Display.isCloseRequested()) {
      int delta = getDelta();

      update(delta);
      renderGL();

      Display.update();
      Display.sync(60); // cap fps to 60fps
    }

    Display.destroy();
  }
  public static void main(String[] args) throws InterruptedException {
    try {
      Display.setTitle("Simple Square");
      Display.create();
    } catch (LWJGLException e) {
      e.printStackTrace();
    }

    // draw the square
    glBegin(GL_LINE_LOOP);
    glVertex3f(-0.5f, -0.5f, 0f);
    glVertex3f(-0.5f, 0.5f, 0f);
    glVertex3f(0.5f, 0.5f, 0f);
    glVertex3f(0.5f, -0.5f, 0f);
    glEnd();

    // flush any commands that are still hanging about.
    glFlush();
    // update window.
    Display.update();

    while (!Display.isCloseRequested()) {
      Thread.sleep(100);
    }
    Display.destroy();
  }
Exemple #10
0
  /**
   * Initialise the controllers system
   *
   * @throws SlickException Indicates a failure to use the hardware
   */
  public void initControllers() throws SlickException {
    if (controllersInited) {
      return;
    }

    controllersInited = true;
    try {
      Controllers.create();
      int count = Controllers.getControllerCount();

      for (int i = 0; i < count; i++) {
        Controller controller = Controllers.getController(i);

        if ((controller.getButtonCount() >= 3) && (controller.getButtonCount() < MAX_BUTTONS)) {
          controllers.add(controller);
        }
      }

      Log.info("Found " + controllers.size() + " controllers");
      for (int i = 0; i < controllers.size(); i++) {
        Log.info(i + " : " + ((Controller) controllers.get(i)).getName());
      }
    } catch (LWJGLException e) {
      if (e.getCause() instanceof ClassNotFoundException) {
        throw new SlickException(
            "Unable to create controller - no jinput found - add jinput.jar to your classpath");
      }
      throw new SlickException("Unable to create controllers");
    } catch (NoClassDefFoundError | UnsatisfiedLinkError e) {
      // forget it, no jinput availble
    }
  }
 private static void initControls() {
   // Automatically create mouse, keyboard and controller
   if (!getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput")) {
     if (!Mouse.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nomouse")) {
       try {
         Mouse.create();
       } catch (LWJGLException e) {
         if (LWJGLUtil.DEBUG) {
           e.printStackTrace(System.err);
         } else {
           LWJGLUtil.log("Failed to create Mouse: " + e);
         }
       }
     }
     if (!Keyboard.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nokeyboard")) {
       try {
         Keyboard.create();
       } catch (LWJGLException e) {
         if (LWJGLUtil.DEBUG) {
           e.printStackTrace(System.err);
         } else {
           LWJGLUtil.log("Failed to create Keyboard: " + e);
         }
       }
     }
   }
 }
 private void initGL() {
   try {
     Display.setDisplayMode(new DisplayMode(GS.FRAMEWIDTH, GS.FRAMEHEIGHT));
     Display.setFullscreen(true);
     Display.create();
     Display.setVSyncEnabled(true);
   } catch (LWJGLException e) {
     e.printStackTrace();
     Display.destroy();
     System.exit(1);
   }
   GL11.glEnable(GL11.GL_TEXTURE_2D);
   // GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
   GL11.glClearDepth(1.0f);
   // GL11.glEnable(GL11.GL_DEPTH_TEST);
   // GL11.glDepthFunc(GL11.GL_ADD); //Wenn nicht auskommentiert führt es zu Exception
   GL11.glMatrixMode(GL11.GL_PROJECTION);
   GL11.glViewport(0, 0, GS.FRAMEWIDTH, GS.FRAMEHEIGHT);
   GL11.glOrtho(0, GS.FRAMEWIDTH, GS.FRAMEHEIGHT, 0, 0, 128);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   // GL11.glBlendEquation( BLENDING_EQUATIONS[blendingEquationIndex]);
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glMatrixMode(GL11.GL_MODELVIEW);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glAlphaFunc(GL11.GL_GREATER, 0);
   GL11.glCullFace(GL11.GL_BACK);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   GL11.glLoadIdentity();
 }
Exemple #13
0
  /**
   * Start the application. The window is opened and the main loop is entered. This call does not
   * return until the window is closed or an exception was caught.
   */
  public void start() {
    try {
      Display.setDisplayMode(new DisplayMode(width, height));
      Display.setTitle(title);
      if (multisampling) Display.create(new PixelFormat().withSamples(8));
      else Display.create();

      // Sync buffer swap with vertical sync. Results in 60 fps on my Mac
      // Book.
      Display.setSwapInterval(1);
      Display.setVSyncEnabled(true);

      input = new Input();
      application.init();

      while (!Display.isCloseRequested()) {
        input.update();
        input.setWindowSize(width, height);
        application.simulate(time.elapsed(), input);
        application.display(width, height, input);
        Display.update();
      }
    } catch (LWJGLException e) {
      e.printStackTrace();
    } finally {
      Display.destroy();
    }
  }
Exemple #14
0
  private void init(boolean absolutePixels, boolean testModes) {
    // find out what the current bits per pixel of the desktop is
    int currentBpp = Display.getDisplayMode().getBitsPerPixel();

    try {
      DisplayMode mode;
      if (testModes) mode = findDisplayMode(WINDOW_WIDTH, WINDOW_HEIGHT, currentBpp);
      else mode = new DisplayMode(WINDOW_WIDTH, WINDOW_HEIGHT);

      Display.setDisplayMode(mode);
      Display.setFullscreen(false);
      Display.setTitle("src");
      Display.create();
    } catch (LWJGLException e) {
      e.printStackTrace();
    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    double aspectRatio = (double) WINDOW_WIDTH / WINDOW_HEIGHT;

    if (absolutePixels) {
      glOrtho(0.0d, WINDOW_WIDTH, 0.0d, WINDOW_HEIGHT, 1.0d, -1.0d);
    } else {
      glOrtho(aspectRatio, -aspectRatio, -1.0d, 1.0d, 1.0d, -1.0d);
    }

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
  }
Exemple #15
0
 public static void setParent(Canvas canvas) {
   try {
     Display.setParent(canvas);
   } catch (LWJGLException e) {
     e.printStackTrace();
     System.exit(1);
   }
 }
Exemple #16
0
 public static void toggleFullscreen() {
   Globals.fullscreen = !Globals.fullscreen;
   try {
     Display.setFullscreen(Globals.fullscreen);
     Display.update();
   } catch (LWJGLException e) {
     e.printStackTrace();
   }
 }
 @Override
 public void setFullscreen(final boolean fullscreen) {
   try {
     Display.setFullscreen(fullscreen);
   } catch (LWJGLException e) {
     e.printStackTrace();
     System.exit(1);
   }
 }
Exemple #18
0
 public static void setSize(int width, int height) {
   try {
     displayMode = new DisplayMode(width, height);
     Display.setDisplayMode(displayMode);
   } catch (LWJGLException e) {
     e.printStackTrace();
     System.exit(1);
   }
 }
  public void execute() {
    // Initialize OpenAL and clear the error bit.
    try {
      AL.create();
    } catch (LWJGLException le) {
      le.printStackTrace();
      return;
    }
    AL10.alGetError();

    // Load the wav data.
    if (loadALData() == AL10.AL_FALSE) {
      System.out.println("Error loading data.");
      return;
    }

    setListenerValues();

    // Loop.
    System.out.println("OpenAL Tutorial 1 - Single Static Source");
    System.out.println("[Menu]");
    System.out.println("p - Play the sample.");
    System.out.println("s - Stop the sample.");
    System.out.println("h - Pause the sample.");
    System.out.println("q - Quit the program.");
    char c = ' ';
    Scanner stdin = new Scanner(System.in);
    while (c != 'q') {
      try {
        System.out.print("Input: ");
        c = (char) stdin.nextLine().charAt(0);
      } catch (Exception ex) {
        c = 'q';
      }

      switch (c) {
          // Pressing 'p' will begin playing the sample.
        case 'p':
          AL10.alSourcePlay(source.get(0));
          break;

          // Pressing 's' will stop the sample from playing.
        case 's':
          AL10.alSourceStop(source.get(0));
          break;

          // Pressing 'h' will pause the sample.
        case 'h':
          AL10.alSourcePause(source.get(0));
          break;
      }
      ;
    }
    killALData();
    AL.destroy();
  }
Exemple #20
0
  public static void setWindowResolution(int width, int height) {
    Globals.windowWidth = width;
    Globals.windowHeight = height;
    Globals.aspectRatio = (float) Globals.windowWidth / (float) Globals.windowHeight;
    Globals.windowMatrix.set(
        1 / Globals.aspectRatio,
        0.0f,
        0.0f,
        0.0f,
        0.0f,
        1.0f,
        0.0f,
        0.0f,
        0.0f,
        0.0f,
        1.0f,
        0.0f,
        0.0f,
        0.0f,
        0.0f,
        1.0f);

    // for(IWindowChangeListener lis : Globals.windowChangeListener)
    // {
    //	lis.onWindowResolutionChange(Globals.windowWidth, Globals.windowHeight);
    // }

    try {
      DisplayMode[] modes = Display.getAvailableDisplayModes();

      DisplayMode finalMode = new DisplayMode(Globals.getWindowWidth(), Globals.getWindowHeight());

      for (int i = 0; i < modes.length; i++) {
        DisplayMode current = modes[i];
        if (current.getWidth() == Globals.getWindowWidth()
            && current.getHeight() == Globals.getWindowHeight()
            && current.getBitsPerPixel() == 32
            && current.getFrequency() == 60) finalMode = current;
      }

      Display.setDisplayMode(finalMode);

      if (!Display.isCreated()) {
        PixelFormat pixelFormat = new PixelFormat();
        ContextAttribs contextAtrributes =
            new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true);
        Display.create(pixelFormat, contextAtrributes);
      }

      GL11.glViewport(0, 0, Globals.getWindowWidth(), Globals.getWindowHeight());
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(-1);
    }
    Display.update();
  }
 private static void setUpDisplay() {
   try {
     Display.setDisplayMode(new DisplayMode(WINDOW_DIMENSIONS[0], WINDOW_DIMENSIONS[1]));
     Display.setTitle(WINDOW_TITLE);
     Display.create();
   } catch (LWJGLException e) {
     e.printStackTrace();
     cleanUp(true);
   }
 }
 private void createWindow() {
   try {
     Display.setDisplayMode(DISPLAY_MODE);
     Display.setFullscreen(fullscreen);
     Display.setTitle(WINDOW_TITLE);
     Display.create();
   } catch (LWJGLException e) {
     e.printStackTrace();
   }
 }
 private void setUpDisplay() {
   try {
     Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
     Display.setTitle("Pong");
     Display.create();
   } catch (LWJGLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Exemple #24
0
 public static void create() {
   try {
     Display.create();
     Mouse.create();
     Keyboard.create();
   } catch (LWJGLException e) {
     e.printStackTrace();
     System.exit(1);
   }
 }
Exemple #25
0
  public void start() {
    try {
      Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
      Display.create();
      Display.setFullscreen(true);
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(0);
    }

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glClearAccum(0f, 0f, 0f, 1f);
    GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT);

    while (!Display.isCloseRequested() && !finished) {
      if (System.currentTimeMillis() - time > 1000) {
        System.out.println(framecount + " FPS");
        time = System.currentTimeMillis();
        framecount = 0;
      }

      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

      GL11.glColor3f(1, 1, 1);

      GL11.glMatrixMode(GL11.GL_MODELVIEW);
      GL11.glLoadIdentity();
      GL11.glOrtho(0, WIDTH, HEIGHT, 0, -10, 10);
      Manager.DrawBackground();

      GL11.glMatrixMode(GL11.GL_MODELVIEW);
      GL11.glLoadIdentity();
      GL11.glOrtho(0, WIDTH, HEIGHT, 0, -10, 10);

      GL11.glTranslatef(-Camera.x, -Camera.y, 0);
      Display.sync(60);

      Manager.Draw();
      Manager.Update();

      GL11.glMatrixMode(GL11.GL_MODELVIEW);
      GL11.glLoadIdentity();
      GL11.glOrtho(0, WIDTH, HEIGHT, 0, -10, 10);
      Manager.DrawForeground();

      Display.update();

      framecount++;
    }
  }
Exemple #26
0
 public MouseHelper(Component p_i174_1_) {
   field_1115_e = 10;
   field_1117_c = p_i174_1_;
   IntBuffer intbuffer = GLAllocation.func_1125_c(1);
   intbuffer.put(0);
   intbuffer.flip();
   IntBuffer intbuffer1 = GLAllocation.func_1125_c(1024);
   try {
     field_1116_d = new Cursor(32, 32, 16, 16, 1, intbuffer1, intbuffer);
   } catch (LWJGLException lwjglexception) {
     lwjglexception.printStackTrace();
   }
 }
Exemple #27
0
 private void initializeOpenGL() {
   // Open the program window
   try {
     PixelFormat pf = new PixelFormat(24, 8, 24, 0, 16);
     Display.setDisplayMode(new DisplayMode(boxWidth, boxHeight));
     Display.setTitle("Particles");
     Display.setVSyncEnabled(true);
     Display.create(pf);
   } catch (LWJGLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Exemple #28
0
 public void resetDisplayMode() {
   try {
     doSetGammaRamp(saved_gamma);
   } catch (LWJGLException e) {
     LWJGLUtil.log("Failed to reset gamma ramp: " + e.getMessage());
   }
   current_gamma = saved_gamma;
   if (mode_set) {
     mode_set = false;
     nResetDisplayMode();
   }
   resetCursorClipping();
 }
Exemple #29
0
 private void updateClipping() {
   if ((Display.isFullscreen() || (mouse != null && mouse.isGrabbed()))
       && !isMinimized
       && isFocused
       && (getForegroundWindow() == getHwnd() || hasParent)) {
     try {
       setupCursorClipping(getHwnd());
     } catch (LWJGLException e) {
       LWJGLUtil.log("setupCursorClipping failed: " + e.getMessage());
     }
   } else {
     resetCursorClipping();
   }
 }
Exemple #30
0
  public Main() {
    try {
      Display.setDisplayMode(new DisplayMode(800, 600));
      Display.create();

      while (!Display.isCloseRequested()) {
        Display.update();
      }

      Display.destroy();
    } catch (LWJGLException e) {
      e.printStackTrace();
    }
  }